Remove all of the current smiley support as it currently isn't used and needs to be completely overhauled for the new emoji api when we write it.
Testing Done:
Ran the unit tests, `ninja pidgin-pot doc`, ran pidgin3, opened the preferences page, verified the `custom smileys menu was removed`, sent messages over xmpp with text smileys and verified that pidgin 2 still rendered them.
Reviewed at https://reviews.imfreedom.org/r/852/
--- a/ChangeLog.API Tue Aug 24 04:51:11 2021 -0500
+++ b/ChangeLog.API Tue Aug 24 04:52:14 2021 -0500
@@ -355,13 +355,20 @@
Use GLib's GHmac or GChecksum instead.
* purple_connection_error_reason
+ * PURPLE_CONNECTION_FLAG_ALLOW_CUSTOM_SMILEY * purple_connection_new_unregister
* purple_connection_destroy
* purple_connection_set_account
* purple_contact_set_alias
* purple_conv_chat_set_users
+ * purple_conv_custom_smiley_add + * purple_conv_custom_smiley_close + * purple_conv_custom_smiley_write + * purple_conversation_add_smiley + * purple_conversation_get_remote_smileys + * purple_conversation_get_smiley * purple_conversations_add. Use purple_conversation_manager_register
* purple_conversations_remove. Use
@@ -520,6 +527,24 @@
purple_roomlist_set_protocol_data
* PurpleSetPublicAliasFailureCallback
* PurpleSetPublicAliasSuccessCallback
+ * purple_smiley_get_type + * purple_smiley_new_from_file + * purple_smiley_set_shortcut + * purple_smiley_set_data + * purple_smiley_get_shortcut + * purple_smiley_get_checksum + * purple_smiley_get_stored_image + * purple_smiley_get_data + * purple_smiley_get_extension + * purple_smiley_get_full_path + * purple_smileys_get_all + * purple_smileys_find_by_shortcut + * purple_smileys_find_by_checksum + * purple_smileys_get_storing_dir + * purple_smileys_uninit * purple_socket_get_family
* purple_socket_speaks_ipv4
@@ -692,9 +717,6 @@
removed the accel related parameters.
* pidgin_setup_screenname_autocomplete now takes a filter function and
its data as final two arguments
- * smiley_list renamed to PidginSmileyList
- * smiley_parse_markup renamed to pidgin_smiley_parse_markup
- * smiley_theme renamed to PidginSmileyTheme
* PidginWindow renamed to PidginConvWindow
@@ -785,6 +807,17 @@
* pidgin_set_sensitive_if_input
* pidgin_set_urgent, use gtk_window_set_urgency_hint instead.
* pidgin_setup_screenname_autocomplete_with_filter
+ * pidgin_smiley_add_to_list + * pidgin_smiley_del_from_list + * pidgin_smiley_manager_show + * pidgin_smiley_editor_set_shortcut + * pidgin_smiley_editor_set_image + * pidgin_smiley_editor_set_data + * pidgin_smileys_uninit + * pidgin_smileys_get_all * pidgin_sound_get_event_label
* pidgin_sound_get_event_option
* pidgin_sound_get_handle
@@ -797,6 +830,7 @@
* pidgin_status_box_set_buddy_icon
* pidgin_status_box_set_network_available
* pidgin_stock_id_from_presence
+ * PIDGIN_STOCK_TOOLBAR_SMILEY * pidgin_text_combo_box_entry_set_text
* pidgin_theme_font_get_color
@@ -826,6 +860,9 @@
--- a/doc/reference/libpurple/libpurple-docs.xml Tue Aug 24 04:51:11 2021 -0500
+++ b/doc/reference/libpurple/libpurple-docs.xml Tue Aug 24 04:52:14 2021 -0500
@@ -139,16 +139,6 @@
<xi:include href="xml/cmds.xml" />
- <title>Smiley APIs</title>
- <xi:include href="xml/smiley.xml" />
- <xi:include href="xml/smiley-custom.xml" />
- <xi:include href="xml/smiley-list.xml" />
- <xi:include href="xml/smiley-theme.xml" />
- <xi:include href="xml/smiley-parser.xml" />
--- a/doc/reference/pidgin/pidgin-docs.xml Tue Aug 24 04:51:11 2021 -0500
+++ b/doc/reference/pidgin/pidgin-docs.xml Tue Aug 24 04:52:14 2021 -0500
@@ -36,8 +36,6 @@
<xi:include href="xml/gtkrequest.xml" />
<xi:include href="xml/gtkroomlist.xml" />
<xi:include href="xml/gtksavedstatuses.xml" />
- <xi:include href="xml/gtksmiley-manager.xml" />
- <xi:include href="xml/gtksmiley-theme.xml" />
<xi:include href="xml/gtkstatus-icon-theme.xml" />
<xi:include href="xml/gtkstatusbox.xml" />
<xi:include href="xml/gtkutils.xml" />
--- a/libpurple/connection.h Tue Aug 24 04:51:11 2021 -0500
+++ b/libpurple/connection.h Tue Aug 24 04:52:14 2021 -0500
@@ -81,8 +81,6 @@
* @PURPLE_CONNECTION_FLAG_NO_IMAGES: Connection does not support sending of
- * @PURPLE_CONNECTION_FLAG_ALLOW_CUSTOM_SMILEY: Connection supports sending
- * and receiving custom smileys
* @PURPLE_CONNECTION_FLAG_SUPPORT_MOODS: Connection supports setting moods
* @PURPLE_CONNECTION_FLAG_SUPPORT_MOOD_MESSAGES: Connection supports setting
@@ -99,7 +97,6 @@
PURPLE_CONNECTION_FLAG_NO_FONTSIZE = 0x0020,
PURPLE_CONNECTION_FLAG_NO_URLDESC = 0x0040,
PURPLE_CONNECTION_FLAG_NO_IMAGES = 0x0080,
- PURPLE_CONNECTION_FLAG_ALLOW_CUSTOM_SMILEY = 0x0100,
PURPLE_CONNECTION_FLAG_SUPPORT_MOODS = 0x0200,
PURPLE_CONNECTION_FLAG_SUPPORT_MOOD_MESSAGES = 0x0400
--- a/libpurple/core.c Tue Aug 24 04:51:11 2021 -0500
+++ b/libpurple/core.c Tue Aug 24 04:52:14 2021 -0500
@@ -40,9 +40,6 @@
#include "purpleprivate.h"
#include "savedstatuses.h"
-#include "smiley-custom.h"
-#include "smiley-parser.h"
-#include "smiley-theme.h"
#include "theme-manager.h"
@@ -180,8 +177,6 @@
- _purple_smiley_custom_init();
- _purple_smiley_parser_init();
* Call this early on to try to auto-detect our IP address and
@@ -223,9 +218,6 @@
purple_connections_disconnect_all();
/* Save .xml files, remove signals, etc. */
- _purple_smiley_theme_uninit();
- _purple_smiley_custom_uninit();
- _purple_smiley_parser_uninit();
purple_conversation_manager_shutdown();
purple_conversations_uninit();
@@ -371,14 +363,12 @@
xdg_dir_exists = g_file_test(purple_data_dir(), G_FILE_TEST_EXISTS);
MIGRATE_TO_XDG_DIR(purple_data_dir(), "certificates");
- MIGRATE_TO_XDG_DIR(purple_data_dir(), "custom_smiley");
MIGRATE_TO_XDG_DIR(purple_data_dir(), "logs");
MIGRATE_TO_XDG_DIR(purple_config_dir(), "accounts.xml");
MIGRATE_TO_XDG_DIR(purple_config_dir(), "blist.xml");
MIGRATE_TO_XDG_DIR(purple_config_dir(), "fs-codec.conf");
MIGRATE_TO_XDG_DIR(purple_config_dir(), "fs-element.conf");
MIGRATE_TO_XDG_DIR(purple_config_dir(), "prefs.xml");
- MIGRATE_TO_XDG_DIR(purple_config_dir(), "smileys.xml");
MIGRATE_TO_XDG_DIR(purple_config_dir(), "status.xml");
--- a/libpurple/meson.build Tue Aug 24 04:51:11 2021 -0500
+++ b/libpurple/meson.build Tue Aug 24 04:52:14 2021 -0500
@@ -81,11 +81,6 @@
@@ -178,11 +173,6 @@
--- a/libpurple/protocols/jabber/jabber.c Tue Aug 24 04:51:11 2021 -0500
+++ b/libpurple/protocols/jabber/jabber.c Tue Aug 24 04:52:14 2021 -0500
@@ -1076,7 +1076,6 @@
purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_HTML |
- PURPLE_CONNECTION_FLAG_ALLOW_CUSTOM_SMILEY |
PURPLE_CONNECTION_FLAG_NO_IMAGES);
js = jabber_stream_new(account);
--- a/libpurple/protocols/jabber/message.c Tue Aug 24 04:51:11 2021 -0500
+++ b/libpurple/protocols/jabber/message.c Tue Aug 24 04:52:14 2021 -0500
@@ -34,11 +34,6 @@
- PurpleConversation *conv;
-} JabberMessageRemoteSmileyAddData;
static GString *jm_body_with_oob(JabberMessage *jm) {
GString *body = g_string_new("");
@@ -339,70 +334,6 @@
purple_protocol_got_attention(jm->js->gc, jm->from, 0);
-jabber_message_get_refs_from_xmlnode_internal(const PurpleXmlNode *message,
- for (child = purple_xmlnode_get_child(message, "img") ; child ;
- child = purple_xmlnode_get_next_twin(child)) {
- const gchar *src = purple_xmlnode_get_attrib(child, "src");
- if (g_str_has_prefix(src, "cid:")) {
- const gchar *cid = src + 4;
- /* if we haven't "fetched" this yet... */
- if (!g_hash_table_lookup(table, cid)) {
- const gchar *alt = purple_xmlnode_get_attrib(child, "alt");
- /* if there is no "alt" string, use the cid...
- include the entire src, eg. "cid:.." to avoid linkification */
- if (alt && alt[0] != '\0') {
- /* workaround for when "alt" is set to the value of the
- CID (which Jabbim seems to do), to avoid it showing up
- if (purple_email_is_valid(alt)) {
- value = g_strdup_printf("smiley:%s", alt);
- g_hash_table_insert(table, g_strdup(cid), value);
- for (child = message->child ; child ; child = child->next) {
- jabber_message_get_refs_from_xmlnode_internal(child, table);
-jabber_message_get_refs(gpointer key, gpointer value, gpointer user_data)
- GList **refs = (GList **) user_data;
- PurpleKeyValuePair *ref = purple_key_value_pair_new_full(key, value, g_free);
- *refs = g_list_append(*refs, ref);
-jabber_message_get_refs_from_xmlnode(const PurpleXmlNode *message)
- GHashTable *unique_refs = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
- jabber_message_get_refs_from_xmlnode_internal(message, unique_refs);
- (void)g_hash_table_foreach_remove(unique_refs, jabber_message_get_refs, &refs);
- g_hash_table_destroy(unique_refs);
jabber_message_xml_to_string_strip_img_smileys(PurpleXmlNode *xhtml)
@@ -474,101 +405,6 @@
return g_string_free(out, FALSE);
-jabber_message_add_remote_smileys(JabberStream *js, const gchar *who,
- const PurpleXmlNode *message)
- PurpleXmlNode *data_tag;
- for (data_tag = purple_xmlnode_get_child_with_namespace(message, "data", NS_BOB) ;
- data_tag = purple_xmlnode_get_next_twin(data_tag)) {
- const gchar *cid = purple_xmlnode_get_attrib(data_tag, "cid");
- const JabberData *data = jabber_data_find_remote_by_cid(js, who, cid);
- if (!data && cid != NULL) {
- /* we haven't cached this already, let's add it */
- JabberData *new_data = jabber_data_create_from_xml(data_tag);
- jabber_data_associate_remote(js, who, new_data);
-jabber_message_remote_smiley_got(JabberData *jdata, gchar *alt, gpointer d) {
- JabberMessageRemoteSmileyAddData *data = (JabberMessageRemoteSmileyAddData *)d;
- PurpleSmiley *smiley = NULL;
- purple_debug_info("jabber",
- "smiley data retrieved successfully");
- smiley = purple_smiley_new_from_data(
- jabber_data_get_data(jdata),
- jabber_data_get_size(jdata)
- purple_conversation_add_smiley(data->conv, smiley);
- g_object_unref(G_OBJECT(smiley));
- purple_debug_error("jabber", "failed retrieving smiley data");
- g_object_unref(G_OBJECT(data->conv));
- g_free(data->shortcut);
- g_slice_free(JabberMessageRemoteSmileyAddData, data);
-jabber_message_remote_smiley_add(JabberStream *js, PurpleConversation *conv,
- const gchar *from, const gchar *shortcut, const gchar *cid)
- PurpleSmiley *smiley = NULL;
- const JabberData *jdata = NULL;
- purple_debug_misc("jabber", "about to add remote smiley %s to the conv",
- smiley = purple_conversation_get_smiley(conv, shortcut);
- if(PURPLE_IS_SMILEY(smiley)) {
- purple_debug_misc("jabber", "smiley was already present");
- /* TODO: cache lookup by "cid" */
- jdata = jabber_data_find_remote_by_cid(js, from, cid);
- purple_debug_info("jabber", "smiley data is already known");
- smiley = purple_smiley_new_from_data(
- jabber_data_get_data(jdata),
- jabber_data_get_size(jdata)
- purple_conversation_add_smiley(conv, smiley);
- g_object_unref(G_OBJECT(smiley));
- JabberMessageRemoteSmileyAddData *data = NULL;
- data = g_slice_new(JabberMessageRemoteSmileyAddData);
- data->conv = g_object_ref(conv);
- data->shortcut = g_strdup(shortcut);
- purple_debug_info("jabber", "smiley data is unknown, "
- jabber_data_request(js, cid, from, NULL, FALSE,
- jabber_message_remote_smiley_got, data);
void jabber_message_parse(JabberStream *js, PurpleXmlNode *packet)
@@ -731,52 +567,8 @@
} else if(purple_strequal(child->name, "html") && purple_strequal(xmlns, NS_XHTML_IM)) {
if(!jm->xhtml && purple_xmlnode_get_child(child, "body")) {
- PurpleConnection *gc = js->gc;
- PurpleAccount *account = purple_connection_get_account(gc);
- PurpleConversation *conv = NULL;
- GList *smiley_refs = NULL;
gchar *reformatted_xhtml;
- if (purple_account_get_bool(account, "custom_smileys", TRUE)) {
- /* find a list of smileys ("cid" and "alt" text pairs)
- occuring in the message */
- smiley_refs = jabber_message_get_refs_from_xmlnode(child);
- purple_debug_info("jabber", "found %d smileys\n",
- g_list_length(smiley_refs));
- if (jm->type == JABBER_MESSAGE_GROUPCHAT) {
- JabberID *jid = jabber_id_new(jm->from);
- JabberChat *chat = NULL;
- chat = jabber_chat_find(js, jid->node, jid->domain);
- conv = PURPLE_CONVERSATION(chat->conv);
- } else if (jm->type == JABBER_MESSAGE_NORMAL ||
- jm->type == JABBER_MESSAGE_CHAT)
- PurpleConversationManager *manager;
- manager = purple_conversation_manager_get_default();
- conv = purple_conversation_manager_find(manager,
- /* we need to create the conversation here */
- conv = PURPLE_CONVERSATION(
- purple_im_conversation_new(account, from));
- /* process any newly provided smileys */
- jabber_message_add_remote_smileys(js, to, packet);
purple_xmlnode_strip_prefixes(child);
/* reformat xhtml so that img tags with a "cid:" src gets
@@ -788,20 +580,6 @@
jm->xhtml = reformatted_xhtml;
- /* add known custom emoticons to the conversation */
- /* note: if there were no smileys in the incoming message, or
- if receiving custom smileys is turned off, smiley_refs will
- for (GList *it = smiley_refs; it; it = g_list_next(it)) {
- PurpleKeyValuePair *ref = it->data;
- jabber_message_remote_smiley_add(js,
- conv, from, ref->value, ref->key);
- g_list_free_full(smiley_refs, (GDestroyNotify)purple_key_value_pair_free);
/* Convert all newlines to whitespace. Technically, even regular, non-XML HTML is supposed to ignore newlines, but Pidgin has, as convention
* treated \n as a newline for compatibility with other protocols
@@ -923,147 +701,6 @@
-jabber_conv_support_custom_smileys(JabberStream *js,
- PurpleConversation *conv, const gchar *who)
- if (PURPLE_IS_IM_CONVERSATION(conv)) {
- jb = jabber_buddy_find(js, who, FALSE);
- return jabber_buddy_has_capability(jb, NS_BOB);
- } else if (PURPLE_IS_CHAT_CONVERSATION(conv)) {
- chat = jabber_chat_find_by_conv(PURPLE_CHAT_CONVERSATION(conv));
- /* do not attempt to send custom smileys in a MUC with more than
- 10 people, to avoid getting too many BoB requests */
- return jabber_chat_get_num_participants(chat) <= 10 &&
- jabber_chat_all_participants_have_capability(chat,
-jabber_message_smileyify_cb(GString *out, PurpleSmiley *smiley,
- PurpleConversation *_empty, gpointer _unused)
- const JabberData *data;
- PurpleXmlNode *smiley_node;
- shortcut = purple_smiley_get_shortcut(smiley);
- data = jabber_data_find_local_by_alt(shortcut);
- smiley_node = jabber_data_get_xhtml_im(data, shortcut);
- node_xml = purple_xmlnode_to_str(smiley_node, NULL);
- g_string_append(out, node_xml);
- purple_xmlnode_free(smiley_node);
-jabber_message_smileyfy_xhtml(JabberMessage *jm, const char *xhtml)
- PurpleAccount *account = purple_connection_get_account(jm->js->gc);
- GList *found_smileys, *it, *it_next;
- PurpleConversation *conv;
- PurpleConversationManager *manager;
- gboolean has_too_large_smiley = FALSE;
- gchar *smileyfied_xhtml = NULL;
- manager = purple_conversation_manager_get_default();
- conv = purple_conversation_manager_find(manager, account, jm->to);
- if (!jabber_conv_support_custom_smileys(jm->js, conv, jm->to))
- found_smileys = purple_smiley_parser_find(
- purple_smiley_custom_get_list(), xhtml, TRUE);
- for (it = found_smileys; it; it = it_next) {
- PurpleSmiley *smiley = it->data;
- it_next = g_list_next(it);
- if (purple_image_get_data_size(PURPLE_IMAGE(smiley)) > JABBER_DATA_MAX_SIZE) {
- has_too_large_smiley = TRUE;
- purple_debug_warning("jabber", "Refusing to send "
- "smiley %s (too large, max is %d)",
- purple_smiley_get_shortcut(smiley),
- found_smileys = g_list_delete_link(found_smileys, it);
- if (has_too_large_smiley) {
- purple_conversation_write_system_message(conv,
- _("A custom smiley in the message is too large to send."),
- for (it = found_smileys; it; it = g_list_next(it)) {
- PurpleSmiley *smiley = it->data;
- const gchar *shortcut = purple_smiley_get_shortcut(smiley);
- /* the object has been sent before */
- if (jabber_data_find_local_by_alt(shortcut))
- mimetype = purple_image_get_mimetype(PURPLE_IMAGE(smiley));
- purple_debug_error("jabber",
- "unknown mime type for image");
- jdata = jabber_data_create_from_data(
- purple_image_get_data(PURPLE_IMAGE(smiley)),
- purple_image_get_data_size(PURPLE_IMAGE(smiley)),
- mimetype, FALSE, jm->js);
- purple_debug_info("jabber", "cache local smiley alt=%s, cid=%s",
- shortcut, jabber_data_get_cid(jdata));
- jabber_data_associate_local(jdata, shortcut);
- g_list_free(found_smileys);
- smileyfied_xhtml = purple_smiley_parser_replace(
- purple_smiley_custom_get_list(), xhtml,
- jabber_message_smileyify_cb, NULL);
- return smileyfied_xhtml;
void jabber_message_send(JabberMessage *jm)
PurpleXmlNode *message, *child;
@@ -1237,12 +874,6 @@
purple_markup_html_to_xhtml(tmp, &xhtml, &jm->body);
- tmp = jabber_message_smileyfy_xhtml(jm, xhtml);
* For backward compatibility with user expectations or for those not on
* the user's roster, allow sending XHTML-IM markup.
@@ -1289,11 +920,6 @@
tmp = purple_utf8_strip_unprintables(purple_message_get_contents(msg));
purple_markup_html_to_xhtml(tmp, &xhtml, &jm->body);
- tmp = jabber_message_smileyfy_xhtml(jm, xhtml);
if (chat->xhtml && !jabber_xhtml_plain_equal(xhtml, jm->body))
/* Wrap the message in <p/> for greater interoperability justice. */
@@ -1361,10 +987,3 @@
gboolean jabber_buzz_isenabled(JabberStream *js, const gchar *namespace) {
-gboolean jabber_custom_smileys_isenabled(JabberStream *js, const gchar *namespace)
- PurpleAccount *account = purple_connection_get_account(js->gc);
- return purple_account_get_bool(account, "custom_smileys", TRUE);
--- a/libpurple/protocols/jabber/message.h Tue Aug 24 04:51:11 2021 -0500
+++ b/libpurple/protocols/jabber/message.h Tue Aug 24 04:52:14 2021 -0500
@@ -79,6 +79,4 @@
gboolean jabber_buzz_isenabled(JabberStream *js, const gchar *namespace);
-gboolean jabber_custom_smileys_isenabled(JabberStream *js, const gchar *namespace);
#endif /* PURPLE_JABBER_MESSAGE_H */
--- a/libpurple/protocols/jabber/xmpp.c Tue Aug 24 04:51:11 2021 -0500
+++ b/libpurple/protocols/jabber/xmpp.c Tue Aug 24 04:52:14 2021 -0500
@@ -74,13 +74,6 @@
option = purple_account_option_string_new(_("BOSH URL"), "bosh_url", NULL);
opts = g_list_append(opts, option);
- /* this should probably be part of global smiley theme settings
- option = purple_account_option_bool_new(_("Show Custom Smileys"),
- "custom_smileys", TRUE);
- opts = g_list_append(opts, option);
--- a/libpurple/purpleconversation.c Tue Aug 24 04:51:11 2021 -0500
+++ b/libpurple/purpleconversation.c Tue Aug 24 04:52:14 2021 -0500
@@ -38,7 +38,6 @@
#include "purpleprotocolclient.h"
-#include "smiley-list.h"
PurpleAccount *account; /* The user using this conversation. */
@@ -54,11 +53,6 @@
PurpleConnectionFlags features; /* The supported features */
GList *message_history; /* Message history, as a GList of PurpleMessages */
- /* The list of remote smileys. This should be per-buddy (PurpleBuddy),
- * but we don't have any class for people not on our buddy
- * list (PurpleDude?). So, if we have one, we should switch to it. */
- PurpleSmileyList *remote_smileys;
} PurpleConversationPrivate;
@@ -979,60 +973,3 @@
return purple_protocol_client_get_max_message_size(PURPLE_PROTOCOL_CLIENT(protocol), conv);
-purple_conversation_add_smiley(PurpleConversation *conv, PurpleSmiley *smiley) {
- PurpleConversationPrivate *priv = NULL;
- g_return_if_fail(PURPLE_IS_CONVERSATION(conv));
- g_return_if_fail(smiley);
- priv = purple_conversation_get_instance_private(conv);
- if(priv->remote_smileys == NULL) {
- priv->remote_smileys = purple_smiley_list_new();
- g_object_set(priv->remote_smileys, "drop-failed-remotes", TRUE, NULL);
- if(purple_smiley_list_get_by_shortcut(
- purple_smiley_get_shortcut(smiley)))
- /* smiley was already added */
- if(!purple_smiley_list_add(priv->remote_smileys, smiley)) {
- purple_debug_error("conversation", "failed adding remote smiley to "
-purple_conversation_get_smiley(PurpleConversation *conv,
- PurpleConversationPrivate *priv = NULL;
- g_return_val_if_fail(PURPLE_IS_CONVERSATION(conv), NULL);
- g_return_val_if_fail(shortcut, NULL);
- priv = purple_conversation_get_instance_private(conv);
- if(priv->remote_smileys == NULL) {
- return purple_smiley_list_get_by_shortcut(priv->remote_smileys, shortcut);
-purple_conversation_get_remote_smileys(PurpleConversation *conv) {
- PurpleConversationPrivate *priv = NULL;
- g_return_val_if_fail(PURPLE_IS_CONVERSATION(conv), NULL);
- priv = purple_conversation_get_instance_private(conv);
- return priv->remote_smileys;
--- a/libpurple/purpleconversation.h Tue Aug 24 04:51:11 2021 -0500
+++ b/libpurple/purpleconversation.h Tue Aug 24 04:52:14 2021 -0500
@@ -140,7 +140,6 @@
-#include "smiley-list.h"
@@ -446,36 +445,6 @@
gssize purple_conversation_get_max_message_size(PurpleConversation *conv);
- * purple_conversation_add_smiley:
- * @conv: The conversation that receives new smiley.
- * Adds a smiley to the list of smileys that belong to this conversation.
-void purple_conversation_add_smiley(PurpleConversation *conv, PurpleSmiley *smiley);
- * purple_conversation_get_smiley:
- * @conv: The conversation.
- * @shortcut: The shortcut.
- * Lookups for the smiley previously added to this conversation.
- * Returns: (transfer none): The smiley, or %NULL if it doesn't exists.
-PurpleSmiley *purple_conversation_get_smiley(PurpleConversation *conv, const gchar *shortcut);
- * purple_conversation_get_remote_smileys:
- * @conv: The conversation.
- * Get all remote smileys previously added to this conversation.
- * Returns: (transfer none): The list of remote smileys.
-PurpleSmileyList *purple_conversation_get_remote_smileys(PurpleConversation *conv);
* purple_conversation_present_error:
* @who: The user this error is about
* @account: The account this error is on
--- a/libpurple/smiley-custom.c Tue Aug 24 04:51:11 2021 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,325 +0,0 @@
- * 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
-#include "smiley-custom.h"
-#include <glib/gstdio.h>
-#define SMILEYS_DEFAULT_FOLDER "custom_smiley"
-#define SMILEYS_INDEX_FILE "smileys.xml"
-static gchar *smileys_dir;
-static gchar *smileys_index;
-static PurpleSmileyList *smileys_list;
-static gboolean disable_write = FALSE;
-/*******************************************************************************
- ******************************************************************************/
-purple_smiley_custom_load(void)
- PurpleXmlNode *root_node, *profile_node, *smileyset_node, *smiley_node;
- if (!g_file_test(smileys_index, G_FILE_TEST_EXISTS))
- basename = g_path_get_basename(smileys_index);
- dirname = g_path_get_dirname(smileys_index);
- root_node = purple_xmlnode_from_file(dirname, basename,
- "custom smileys index", "smiley-custom");
- g_return_if_fail(root_node);
- profile_node = purple_xmlnode_get_child(root_node, "profile");
- purple_xmlnode_free(root_node);
- g_return_if_fail(profile_node);
- smileyset_node = purple_xmlnode_get_child(profile_node, "smiley_set");
- purple_xmlnode_free(root_node);
- g_return_if_fail(smileyset_node);
- smiley_node = purple_xmlnode_get_child(smileyset_node, "smiley");
- const gchar *shortcut, *file_name;
- shortcut = purple_xmlnode_get_attrib(smiley_node, "shortcut");
- file_name = purple_xmlnode_get_attrib(smiley_node, "filename");
- if (shortcut && file_name) {
- gchar *file_path = g_build_filename(
- smileys_dir, file_name, NULL);
- smiley = purple_smiley_new(shortcut, file_path);
- if (purple_smiley_list_add(smileys_list, smiley)) {
- purple_debug_warning("smiley-custom",
- "Couldn't add '%s' smiley", shortcut);
- g_object_unref(smiley);
- smiley_node = purple_xmlnode_get_next_twin(smiley_node);
- purple_xmlnode_free(root_node);
- purple_debug_info("smiley-custom", "Loaded %d custom smiley(s)",
-smileys_to_xmlnode(void)
- PurpleXmlNode *root_node, *profile_node, *smileyset_node;
- root_node = purple_xmlnode_new("smileys");
- purple_xmlnode_set_attrib(root_node, "version", "1.0");
- profile_node = purple_xmlnode_new("profile");
- purple_xmlnode_insert_child(root_node, profile_node);
- purple_xmlnode_set_attrib(profile_node, "name", "Default");
- smileyset_node = purple_xmlnode_new("smiley_set");
- purple_xmlnode_insert_child(profile_node, smileyset_node);
- smileys = purple_smiley_list_get_all(smileys_list);
- for (it = smileys; it; it = g_list_next(it)) {
- PurpleSmiley *smiley = PURPLE_SMILEY(it->data);
- PurpleXmlNode *smiley_node;
- smiley_node = purple_xmlnode_new("smiley");
- purple_xmlnode_insert_child(smileyset_node, smiley_node);
- purple_xmlnode_set_attrib(smiley_node, "shortcut",
- purple_smiley_get_shortcut(smiley));
- basename = g_path_get_basename(purple_image_get_path(
- PURPLE_IMAGE(smiley)));
- purple_xmlnode_set_attrib(smiley_node, "filename", basename);
-purple_smiley_custom_save(void)
- PurpleXmlNode *root_node;
- root_node = smileys_to_xmlnode();
- g_return_if_fail(root_node != NULL);
- data = purple_xmlnode_to_formatted_str(root_node, NULL);
- g_return_if_fail(data != NULL);
- g_file_set_contents(smileys_index, data, -1, &error);
- purple_xmlnode_free(root_node);
- purple_debug_error("smiley-custom",
- "Error writting custom smileys xml file");
-purple_smiley_custom_img_checksum(PurpleImage *img)
- g_return_val_if_fail(PURPLE_IS_IMAGE(img), NULL);
- return g_compute_checksum_for_data(G_CHECKSUM_SHA1,
- purple_image_get_data(img),
- purple_image_get_data_size(img));
-/*******************************************************************************
- ******************************************************************************/
-purple_smiley_custom_add(PurpleImage *img, const gchar *shortcut)
- PurpleSmiley *existing_smiley, *smiley;
- gchar *checksum, *file_path;
- g_return_val_if_fail(PURPLE_IS_IMAGE(img), NULL);
- existing_smiley = purple_smiley_list_get_by_shortcut(
- smileys_list, shortcut);
- purple_smiley_custom_remove(existing_smiley);
- checksum = purple_smiley_custom_img_checksum(img);
- file_ext = purple_image_get_extension(img);
- if (file_ext == NULL || g_strcmp0("icon", file_ext) == 0) {
- purple_debug_warning("smiley-custom", "Invalid image type");
- g_snprintf(file_name, sizeof(file_name), "%s.%s", checksum, file_ext);
- file_path = g_build_filename(smileys_dir, file_name, NULL);
- if (!purple_image_save(img, file_path)) {
- purple_debug_error("smiley-custom", "Failed writing smiley "
- smiley = purple_smiley_new(shortcut, file_path);
- succ = purple_smiley_list_add(smileys_list, smiley);
- g_object_unref(smiley);
- purple_debug_error("smiley-custom", "Failed adding a smiley");
- purple_smiley_custom_save();
-purple_smiley_custom_remove(PurpleSmiley *smiley)
- PurpleSmiley *existing_smiley;
- const gchar *smiley_shortcut, *path;
- GList *other_smileys, *it;
- g_return_if_fail(PURPLE_IS_SMILEY(smiley));
- smiley_shortcut = purple_smiley_get_shortcut(smiley);
- existing_smiley = purple_smiley_list_get_by_shortcut(
- smileys_list, smiley_shortcut);
- if (existing_smiley == NULL)
- if (existing_smiley != smiley) {
- purple_debug_warning("smiley-custom", "Smiley is not in store");
- purple_smiley_list_remove(smileys_list, smiley);
- path = purple_image_get_path(PURPLE_IMAGE(smiley));
- other_smileys = purple_smiley_list_get_unique(smileys_list);
- for (it = other_smileys; it; it = g_list_next(it)) {
- PurpleSmiley *other = it->data;
- const gchar *other_path = purple_image_get_path(PURPLE_IMAGE(other));
- if (g_strcmp0(other_path, path) == 0) {
- g_list_free(other_smileys);
- g_object_unref(smiley);
- purple_smiley_custom_save();
-purple_smiley_custom_get_list(void)
-/*******************************************************************************
- * Custom smiley subsystem
- ******************************************************************************/
-_purple_smiley_custom_init(void)
- smileys_dir = g_build_filename(purple_data_dir(),
- SMILEYS_DEFAULT_FOLDER, NULL);
- smileys_index = g_build_filename(purple_config_dir(),
- SMILEYS_INDEX_FILE, NULL);
- smileys_list = purple_smiley_list_new();
- ret = g_mkdir(smileys_dir, S_IRUSR | S_IWUSR | S_IXUSR);
- if (ret != 0 && errno != EEXIST) {
- purple_debug_error("smiley-custom", "Failed creating custom "
- "smileys directory: %s (%d)", g_strerror(errno), errno);
- purple_smiley_custom_load();
-_purple_smiley_custom_uninit(void)
- g_object_unref(smileys_list);
--- a/libpurple/smiley-custom.h Tue Aug 24 04:51:11 2021 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
- * 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
-#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
-# error "only <purple.h> may be included directly"
-#ifndef PURPLE_SMILEY_CUSTOM_H
-#define PURPLE_SMILEY_CUSTOM_H
- * SECTION:smiley-custom
- * @include:smiley-custom.h
- * @section_id: libpurple-smiley-custom
- * @short_description: a persistent storage for user-defined smileys
- * @title: Custom smileys storage
- * A custom smiley is a non-standard (not defined by a particular protocol)
- * #PurpleSmiley, defined by user. Some protocols support sending such smileys
- * for other buddies, that do not have such image on their machine. Protocol
- * that supports this feature should set the flag
- * @PURPLE_CONNECTION_FLAG_ALLOW_CUSTOM_SMILEY of #PurpleConnectionFlags.
-#include "smiley-list.h"
- * purple_smiley_custom_add:
- * @image: the smiley's image.
- * @shortcut: textual representation of a smiley.
- * Adds a new smiley to the store. The @shortcut should be unique, but the
- * @image contents don't have to.
- * Returns: (transfer none): A new #PurpleSmiley, or %NULL if error occurred.
-purple_smiley_custom_add(PurpleImage *image, const gchar *shortcut);
- * purple_smiley_custom_remove:
- * @smiley: the smiley to be removed.
- * Removes a @smiley from the store. If the @smiley file is unique (not used by
- * other smileys) it will be removed from a disk.
-purple_smiley_custom_remove(PurpleSmiley *smiley);
- * purple_smiley_custom_get_list:
- * Returns the whole list of user-configured custom smileys.
- * Returns: (transfer none): A #PurpleSmileyList of custom smileys.
-purple_smiley_custom_get_list(void);
- * _purple_smiley_custom_init: (skip)
- * Initializes the custom smileys storage subsystem.
-_purple_smiley_custom_init(void);
- * _purple_smiley_custom_uninit: (skip)
- * Uninitializes the custom smileys storage subsystem.
-_purple_smiley_custom_uninit(void);
-#endif /* PURPLE_SMILEY_CUSTOM_H */
--- a/libpurple/smiley-list.c Tue Aug 24 04:51:11 2021 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,391 +0,0 @@
- * 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
-#include "smiley-list.h"
-#include "smiley-parser.h"
- * A container for #PurpleSmiley's.
-struct _PurpleSmileyList {
- GHashTable *shortcut_map;
- gboolean drop_failed_remotes;
-} PurpleSmileyListPrivate;
- PROP_DROP_FAILED_REMOTES,
-static GParamSpec *properties[PROP_LAST];
-/*******************************************************************************
- ******************************************************************************/
-G_DEFINE_TYPE_WITH_PRIVATE(PurpleSmileyList, purple_smiley_list, G_TYPE_OBJECT);
-purple_smiley_list_init(PurpleSmileyList *list) {
- PurpleSmileyListPrivate *priv = purple_smiley_list_get_instance_private(list);
- priv->trie = purple_trie_new();
- priv->path_map = g_hash_table_new_full(g_str_hash, g_str_equal,
- priv->shortcut_map = g_hash_table_new_full(g_str_hash, g_str_equal,
-purple_smiley_list_finalize(GObject *obj) {
- PurpleSmileyList *sl = PURPLE_SMILEY_LIST(obj);
- PurpleSmileyListPrivate *priv = purple_smiley_list_get_instance_private(sl);
- g_object_unref(priv->trie);
- g_hash_table_destroy(priv->path_map);
- g_hash_table_destroy(priv->shortcut_map);
- for (it = priv->smileys; it; it = g_list_next(it)) {
- PurpleSmiley *smiley = it->data;
- g_object_set_data(G_OBJECT(smiley), "purple-smiley-list", NULL);
- g_object_set_data(G_OBJECT(smiley), "purple-smiley-list-elem", NULL);
- g_object_unref(smiley);
- g_list_free(priv->smileys);
- G_OBJECT_CLASS(purple_smiley_list_parent_class)->finalize(obj);
-purple_smiley_list_get_property(GObject *obj, guint param_id, GValue *value,
- PurpleSmileyList *sl = PURPLE_SMILEY_LIST(obj);
- PurpleSmileyListPrivate *priv = purple_smiley_list_get_instance_private(sl);
- case PROP_DROP_FAILED_REMOTES:
- g_value_set_boolean(value, priv->drop_failed_remotes);
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
-purple_smiley_list_set_property(GObject *obj, guint param_id,
- const GValue *value, GParamSpec *pspec)
- PurpleSmileyList *sl = PURPLE_SMILEY_LIST(obj);
- PurpleSmileyListPrivate *priv = purple_smiley_list_get_instance_private(sl);
- case PROP_DROP_FAILED_REMOTES:
- priv->drop_failed_remotes = g_value_get_boolean(value);
- /* XXX: we could scan for remote smiley's on our list
- * and change the setting, but we don't care that much.
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
-purple_smiley_list_class_init(PurpleSmileyListClass *klass) {
- GObjectClass *obj_class = G_OBJECT_CLASS(klass);
- obj_class->get_property = purple_smiley_list_get_property;
- obj_class->set_property = purple_smiley_list_set_property;
- obj_class->finalize = purple_smiley_list_finalize;
- properties[PROP_DROP_FAILED_REMOTES] = g_param_spec_boolean(
- "drop-failed-remotes", "Drop failed remote PurpleSmileys",
- "Watch added remote smileys and remove them from the list, "
- "if they change their state to failed", FALSE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
- g_object_class_install_properties(obj_class, PROP_LAST, properties);
-/******************************************************************************
- *****************************************************************************/
-_list_append2(GList **head_p, GList **tail_p, gpointer data)
- g_return_if_fail((head == NULL) == (tail == NULL));
- g_return_if_fail((tail == NULL) || (tail->next == NULL));
- *head_p = *tail_p = elem;
-_list_delete_link2(GList **head_p, GList **tail_p, GList *link)
- g_return_if_fail(head != NULL);
- g_return_if_fail(tail != NULL);
- *head_p = g_list_delete_link(head, link);
-smiley_get_uniqid(PurpleSmiley *smiley)
- return purple_image_get_path(PURPLE_IMAGE(smiley));
-/*******************************************************************************
- ******************************************************************************/
-purple_smiley_list_new(void) {
- return g_object_new(PURPLE_TYPE_SMILEY_LIST, NULL);
-purple_smiley_list_add(PurpleSmileyList *list, PurpleSmiley *smiley) {
- PurpleSmileyListPrivate *priv = NULL;
- const gchar *smiley_path;
- gchar *shortcut_escaped;
- g_return_val_if_fail(PURPLE_IS_SMILEY_LIST(list), FALSE);
- g_return_val_if_fail(PURPLE_IS_SMILEY(smiley), FALSE);
- priv = purple_smiley_list_get_instance_private(list);
- if (g_object_get_data(G_OBJECT(smiley), "purple-smiley-list") != NULL) {
- purple_debug_warning("smiley-list",
- "smiley is already associated with some list");
- shortcut = purple_smiley_get_shortcut(smiley);
- if (g_hash_table_lookup(priv->shortcut_map, shortcut) != NULL)
- shortcut_escaped = g_markup_escape_text(shortcut, -1);
- succ = purple_trie_add(priv->trie, shortcut_escaped, smiley);
- /* A special-case for WebKit, which unescapes apos entity.
- * Please, don't trust this hack - it may be removed in future releases.
- if (succ && strstr(shortcut_escaped, "'") != NULL) {
- gchar *tmp = shortcut_escaped;
- shortcut_escaped = purple_strreplace(shortcut_escaped,
- succ = purple_trie_add(priv->trie, shortcut_escaped, smiley);
- g_free(shortcut_escaped);
- _list_append2(&priv->smileys, &priv->smileys_end, smiley);
- g_object_set_data(G_OBJECT(smiley), "purple-smiley-list", list);
- g_object_set_data(G_OBJECT(smiley), "purple-smiley-list-elem",
- g_hash_table_insert(priv->shortcut_map, g_strdup(shortcut), smiley);
- smiley_path = smiley_get_uniqid(smiley);
- /* TODO: add to the table, when the smiley sets the path */
- if (g_hash_table_lookup(priv->path_map, smiley_path) == NULL) {
- g_hash_table_insert(priv->path_map,
- g_strdup(smiley_path), smiley);
-purple_smiley_list_remove(PurpleSmileyList *list, PurpleSmiley *smiley) {
- PurpleSmileyListPrivate *priv = NULL;
- const gchar *shortcut, *path;
- gchar *shortcut_escaped;
- g_return_if_fail(PURPLE_IS_SMILEY_LIST(list));
- g_return_if_fail(PURPLE_IS_SMILEY(smiley));
- priv = purple_smiley_list_get_instance_private(list);
- if (g_object_get_data(G_OBJECT(smiley), "purple-smiley-list") != list) {
- purple_debug_warning("smiley-list", "remove: invalid list");
- list_elem = g_object_get_data(G_OBJECT(smiley),
- "purple-smiley-list-elem");
- shortcut = purple_smiley_get_shortcut(smiley);
- path = smiley_get_uniqid(smiley);
- g_hash_table_remove(priv->shortcut_map, shortcut);
- g_hash_table_remove(priv->path_map, path);
- shortcut_escaped = g_markup_escape_text(shortcut, -1);
- purple_trie_remove(priv->trie, shortcut);
- g_free(shortcut_escaped);
- _list_delete_link2(&priv->smileys, &priv->smileys_end, list_elem);
- /* re-add entry to path_map if smiley was not unique */
- for (it = priv->smileys; it && path; it = g_list_next(it)) {
- PurpleSmiley *smiley = it->data;
- if (g_strcmp0(smiley_get_uniqid(smiley), path) == 0) {
- g_hash_table_insert(priv->path_map,
- g_strdup(path), smiley);
- g_object_set_data(G_OBJECT(smiley), "purple-smiley-list", NULL);
- g_object_set_data(G_OBJECT(smiley), "purple-smiley-list-elem", NULL);
- g_object_unref(smiley);
-purple_smiley_list_is_empty(PurpleSmileyList *list)
- PurpleSmileyListPrivate *priv = NULL;
- g_return_val_if_fail(PURPLE_IS_SMILEY_LIST(list), TRUE);
- priv = purple_smiley_list_get_instance_private(list);
- return (priv->smileys == NULL);
-purple_smiley_list_get_by_shortcut(PurpleSmileyList *list,
- PurpleSmileyListPrivate *priv = NULL;
- g_return_val_if_fail(PURPLE_IS_SMILEY_LIST(list), NULL);
- priv = purple_smiley_list_get_instance_private(list);
- return g_hash_table_lookup(priv->shortcut_map, shortcut);
-purple_smiley_list_get_trie(PurpleSmileyList *list) {
- PurpleSmileyListPrivate *priv = NULL;
- g_return_val_if_fail(PURPLE_IS_SMILEY_LIST(list), NULL);
- priv = purple_smiley_list_get_instance_private(list);
-purple_smiley_list_get_unique(PurpleSmileyList *list) {
- GList *unique = NULL, *it;
- GHashTable *unique_map;
- PurpleSmileyListPrivate *priv = NULL;
- g_return_val_if_fail(PURPLE_IS_SMILEY_LIST(list), NULL);
- priv = purple_smiley_list_get_instance_private(list);
- /* We could just return g_hash_table_get_values(priv->path_map) here,
- * but it won't be in order. */
- unique_map = g_hash_table_new(g_str_hash, g_str_equal);
- for (it = priv->smileys; it; it = g_list_next(it)) {
- PurpleSmiley *smiley = it->data;
- const gchar *path = smiley_get_uniqid(smiley);
- if (g_hash_table_lookup(unique_map, path))
- unique = g_list_prepend(unique, smiley);
- g_hash_table_insert(unique_map, (gpointer)path, smiley);
- g_hash_table_destroy(unique_map);
- return g_list_reverse(unique);
-purple_smiley_list_get_all(PurpleSmileyList *list) {
- PurpleSmileyListPrivate *priv = NULL;
- g_return_val_if_fail(PURPLE_IS_SMILEY_LIST(list), NULL);
- priv = purple_smiley_list_get_instance_private(list);
- return g_hash_table_get_values(priv->shortcut_map);
--- a/libpurple/smiley-list.h Tue Aug 24 04:51:11 2021 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
- * 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
-#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
-# error "only <purple.h> may be included directly"
-#ifndef PURPLE_SMILEY_LIST_H
-#define PURPLE_SMILEY_LIST_H
- * @include:smiley-list.h
- * @section_id: libpurple-smiley-list
- * @short_description: a collection of smileys
- * A #PurpleSmileyList is a handy storage for a set of #PurpleSmiley's.
- * It holds structures needed for parsing, accessing them by a shortcut, or
- * listing (either all, or by unique image).
-#include <glib-object.h>
- * PURPLE_TYPE_SMILEY_LIST:
- * The standard _get_type macro for #PurpleSmileyList.
-#define PURPLE_TYPE_SMILEY_LIST purple_smiley_list_get_type()
- * purple_smiley_list_get_type:
- * Returns: the #GType for a smiley list.
-G_DECLARE_FINAL_TYPE(PurpleSmileyList, purple_smiley_list, PURPLE,
- * purple_smiley_list_new:
- * Creates new #PurpleSmileyList. You might prefer using existing lists, like
- * #purple_smiley_custom_get_list or #purple_conversation_get_remote_smileys
- * (the latter is read-only, accessed with
- * #purple_conversation_add_remote_smiley and
- * #purple_conversation_get_remote_smiley).
- * Returns: newly created #PurpleSmileyList.
-PurpleSmileyList *purple_smiley_list_new(void);
- * purple_smiley_list_add:
- * @list: the smiley list.
- * @smiley: the smiley to be added.
- * Adds the @smiley to the @list. A particular @smiley can only be added to
- * a single @list. Also, a @list can not contain multiple @smiley's with
- * It increases the reference count of @smiley, if needed.
- * Returns: %TRUE if the @smiley was successfully added to the list.
-gboolean purple_smiley_list_add(PurpleSmileyList *list, PurpleSmiley *smiley);
- * purple_smiley_list_remove:
- * @list: the smiley list.
- * @smiley: the smiley to be removed.
- * Removes a @smiley from the @list. If @smiley's reference count drops to zero,
-void purple_smiley_list_remove(PurpleSmileyList *list, PurpleSmiley *smiley);
- * purple_smiley_list_is_empty:
- * @list: the smiley list.
- * Checks, if the smiley @list is empty.
- * Returns: %TRUE if the @list is empty, %FALSE otherwise.
-gboolean purple_smiley_list_is_empty(PurpleSmileyList *list);
- * purple_smiley_list_get_by_shortcut:
- * @list: the smiley list.
- * @shortcut: the textual representation of smiley to lookup.
- * Retrieves a smiley with the specified @shortcut from the @list.
- * Returns: (transfer none): A #PurpleSmiley if the smiley was found, %NULL
-PurpleSmiley *purple_smiley_list_get_by_shortcut(PurpleSmileyList *list, const gchar *shortcut);
- * purple_smiley_list_get_trie:
- * @list: the smiley list.
- * Returns the #PurpleTrie for searching of #PurpleSmiley's being kept
- * in the @list. It holds markup escaped shortcuts, so if you want to search
- * in plain message, you have to escape it first. If you don't do this, it won't
- * find smileys containing special characters.
- * Returns: (transfer none): a #PurpleTrie for contained smileys.
-PurpleTrie *purple_smiley_list_get_trie(PurpleSmileyList *list);
- * purple_smiley_list_get_unique:
- * @list_: the smiley list.
- * Returns the list of smileys with unique image file paths.
- * Returns: (element-type PurpleSmiley) (transfer container): the list of unique smileys.
-GList *purple_smiley_list_get_unique(PurpleSmileyList *list_);
- * purple_smiley_list_get_all:
- * @list_: the smiley list.
- * Returns the list of all smileys added to the @list_.
- * Returns: (element-type PurpleSmiley) (transfer container): the list of smileys.
-GList *purple_smiley_list_get_all(PurpleSmileyList *list_);
-#endif /* PURPLE_SMILEY_LIST_H */
--- a/libpurple/smiley-parser.c Tue Aug 24 04:51:11 2021 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,262 +0,0 @@
- * 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
-#include "smiley-parser.h"
-#include "smiley-custom.h"
-#include "smiley-theme.h"
-#define DISPLAY_OUR_CUSTOM_SMILEYS_FOR_INCOMING_MESSAGES 1
- PurpleConversation *conv;
- PurpleSmileyParseCb cb;
- GHashTable *found_smileys;
-} PurpleSmileyParseData;
-static PurpleTrie *html_sentry;
-purple_smiley_parse_check_html(const gchar *word,
- PurpleSmileyParseData *parse_data)
- if (G_LIKELY(word[0] == '<'))
- parse_data->in_html_tag = TRUE;
- else if (G_LIKELY(word[0] == '>'))
- parse_data->in_html_tag = FALSE;
- g_warn_if_fail(word[1] == '\0');
-purple_smiley_parse_cb(GString *out, const gchar *word, gpointer _smiley,
- PurpleSmileyParseData *parse_data = _parse_data;
- PurpleSmiley *smiley = _smiley;
- /* a special-case for html_sentry */
- purple_smiley_parse_check_html(word, parse_data);
- if (parse_data->in_html_tag)
- return parse_data->job.replace.cb(out, smiley,
- parse_data->job.replace.conv, parse_data->job.replace.ui_data);
-/* XXX: this shouldn't be a conv for incoming messages - see
- * PurpleConversationPrivate.remote_smileys.
- * For outgoing messages, we could pass conv in ui_data (or something).
- * Or maybe we should use two distinct functions?
- * To be reconsidered when we had PurpleDude-like objects.
-purple_smiley_parser_smileify(PurpleConversation *conv, const gchar *html_message,
- gboolean use_remote_smileys, PurpleSmileyParseCb cb, gpointer ui_data)
- PurpleSmileyTheme *theme;
- PurpleSmileyList *theme_smileys = NULL, *remote_smileys = NULL;
- PurpleTrie *theme_trie = NULL, *custom_trie = NULL, *remote_trie = NULL;
- GSList tries_sentry, tries_theme, tries_custom, tries_remote;
- PurpleSmileyParseData parse_data;
- if (html_message == NULL || html_message[0] == '\0')
- return g_strdup(html_message);
- /* get remote smileys */
- if (use_remote_smileys)
- remote_smileys = purple_conversation_get_remote_smileys(conv);
- remote_trie = purple_smiley_list_get_trie(remote_smileys);
- if (remote_trie && purple_trie_get_size(remote_trie) == 0)
- /* get custom smileys */
- if (purple_conversation_get_features(conv) &
- PURPLE_CONNECTION_FLAG_ALLOW_CUSTOM_SMILEY)
- custom_trie = purple_smiley_list_get_trie(
- purple_smiley_custom_get_list());
-#if !DISPLAY_OUR_CUSTOM_SMILEYS_FOR_INCOMING_MESSAGES
- if (use_remote_smileys)
- if (custom_trie && purple_trie_get_size(custom_trie) == 0)
- /* get theme smileys */
- theme = purple_smiley_theme_get_current();
- theme_smileys = purple_smiley_theme_get_smileys(theme, ui_data);
- if (theme_smileys != NULL)
- theme_trie = purple_smiley_list_get_trie(theme_smileys);
- /* we have absolutely no smileys */
- if (theme_trie == NULL && custom_trie == NULL && remote_trie == NULL)
- return g_strdup(html_message);
- /* Create a tries list on the stack. */
- tries_sentry.data = html_sentry;
- tries_theme.data = theme_trie;
- tries_custom.data = custom_trie;
- tries_remote.data = remote_trie;
- tries_sentry.next = NULL;
- tries_theme.next = tries_custom.next = tries_remote.next = NULL;
- if (remote_trie != NULL)
- g_slist_last(tries)->next = &tries_remote;
- if (custom_trie != NULL)
- g_slist_last(tries)->next = &tries_custom;
- if (theme_trie != NULL)
- g_slist_last(tries)->next = &tries_theme;
- parse_data.job.replace.conv = conv;
- parse_data.job.replace.cb = cb;
- parse_data.job.replace.ui_data = ui_data;
- parse_data.in_html_tag = FALSE;
- /* TODO: parse greedily (as much as possible) when PurpleTrie
- * provides support for it. */
- return purple_trie_multi_replace(tries, html_message,
- purple_smiley_parse_cb, &parse_data);
-purple_smiley_parser_replace(PurpleSmileyList *smileys,
- const gchar *html_message, PurpleSmileyParseCb cb, gpointer ui_data)
- PurpleTrie *smileys_trie = NULL;
- PurpleSmileyParseData parse_data;
- if (html_message == NULL || html_message[0] == '\0')
- return g_strdup(html_message);
- if (smileys == NULL || purple_smiley_list_is_empty(smileys))
- return g_strdup(html_message);
- smileys_trie = purple_smiley_list_get_trie(smileys);
- g_return_val_if_fail(smileys_trie != NULL, NULL);
- trie_1.data = html_sentry;
- trie_2.data = smileys_trie;
- parse_data.job.replace.conv = NULL;
- parse_data.job.replace.cb = cb;
- parse_data.job.replace.ui_data = ui_data;
- parse_data.in_html_tag = FALSE;
- return purple_trie_multi_replace(&trie_1, html_message,
- purple_smiley_parse_cb, &parse_data);
-smiley_find_cb(const gchar *word, gpointer _smiley, gpointer _parse_data)
- PurpleSmiley *smiley = _smiley;
- PurpleSmileyParseData *parse_data = _parse_data;
- /* a special-case for html_sentry */
- purple_smiley_parse_check_html(word, parse_data);
- if (parse_data->in_html_tag)
- g_hash_table_insert(parse_data->job.find.found_smileys, smiley, smiley);
-purple_smiley_parser_find(PurpleSmileyList *smileys, const gchar *message,
- PurpleTrie *smileys_trie;
- gchar *escaped_message = NULL;
- PurpleSmileyParseData parse_data;
- if (message == NULL || message[0] == '\0')
- if (smileys == NULL || purple_smiley_list_is_empty(smileys))
- smileys_trie = purple_smiley_list_get_trie(smileys);
- g_return_val_if_fail(smileys_trie != NULL, NULL);
- message = escaped_message = g_markup_escape_text(message, -1);
- parse_data.job.find.found_smileys =
- g_hash_table_new(g_direct_hash, g_direct_equal);
- parse_data.in_html_tag = FALSE;
- trie_1.data = html_sentry;
- trie_2.data = smileys_trie;
- purple_trie_multi_find(&trie_1, message, smiley_find_cb, &parse_data);
- g_free(escaped_message);
- found_list = g_hash_table_get_values(parse_data.job.find.found_smileys);
- g_hash_table_destroy(parse_data.job.find.found_smileys);
-_purple_smiley_parser_init(void)
- html_sentry = purple_trie_new();
- purple_trie_add(html_sentry, "<", NULL);
- purple_trie_add(html_sentry, ">", NULL);
-_purple_smiley_parser_uninit(void)
- g_object_unref(html_sentry);
--- a/libpurple/smiley-parser.h Tue Aug 24 04:51:11 2021 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
- * 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
-#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
-# error "only <purple.h> may be included directly"
-#ifndef PURPLE_SMILEY_PARSER_H
-#define PURPLE_SMILEY_PARSER_H
- * SECTION:smiley-parser
- * @include:smiley-parser.h
- * @section_id: libpurple-smiley-parser
- * @short_description: a efficient smiley processor
- * @title: Smiley parser
- * This module is a fast and easy method for searching (and optionally replacing)
- * #PurpleSmiley's in a text. It may use all suitable smiley sets to smileyify
- * the message in one step. The priority if always the following: remote
- * smileys > local custom smileys > theme smileys.
-#include <purpleconversation.h>
-#include "smiley-list.h"
- * @out: the message buffer.
- * @smiley: found smiley.
- * @conv: the conversation of a message (or %NULL, if not passed).
- * @ui_data: the data being passed to #purple_smiley_parse.
- * A replace callback for the found @smiley. It should append a HTML tag
- * representing the @smiley to the @out string. It must not modify the
- * @out string in other way than appending to its end.
- * If callback decides not to replace a smiley, it must not modify
- * Returns: %TRUE if the smiley was inserted.
-typedef gboolean (*PurpleSmileyParseCb)(GString *out, PurpleSmiley *smiley,
- PurpleConversation *conv, gpointer ui_data);
- * purple_smiley_parser_smileify:
- * @conv: the conversation of a message.
- * @html_message: the html message, or escaped plain message.
- * @use_remote_smileys: %TRUE if remote smileys of @conv should be parsed.
- * @cb: (scope call): The callback to replace smiley text with an image.
- * @ui_data: the user data to be passed to @cb and
- * #purple_smiley_theme_get_smileys.
- * Replaces all textual smiley representations with proper smiley images
- * configured for libpurple.
- * The @use_remote_smileys parameter should be %TRUE for incoming messages,
- * This function is intended for replacing all smileys before displaying. For
- * replacing custom smileys before sending to the other party,
- * see #purple_smiley_parser_replace.
- * Returns: (transfer full): the smileifed message. Should be #g_free'd when
- * done using it. Returns %NULL if and only if @html_message was %NULL.
-purple_smiley_parser_smileify(PurpleConversation *conv, const gchar *html_message,
- gboolean use_remote_smileys, PurpleSmileyParseCb cb, gpointer ui_data);
- * purple_smiley_parser_replace:
- * @smileys: the list of smileys to replace.
- * @html_message: the html message, or escaped plain message.
- * @cb: (scope call): The callback to replace smiley text with an image.
- * @ui_data: (closure cb): The user data to be passed to the callback.
- * Replaces all textual smiley representations from @smileys list with images.
- * This function is intended for replacing custom smileys before sending to the
- * other party. For replacing all sets of smileys (custom, remote and theme) at
- * once (ie. before displaying), use #purple_smiley_parser_smileify.
- * Returns: (transfer full): the smileifed message. Should be #g_free'd when
- * done using it. Returns %NULL if and only if @html_message was %NULL.
-purple_smiley_parser_replace(PurpleSmileyList *smileys,
- const gchar *html_message, PurpleSmileyParseCb cb, gpointer ui_data);
- * purple_smiley_parser_find:
- * @smileys: the list of smileys to find.
- * @message: the message.
- * @is_html: %TRUE if the message is HTML, %FALSE if it's plain, unescaped.
- * Searches for all smileys from the @smileys list present in @message.
- * Each smiley is returned only once, regardless how many times it appeared in
- * text. However, distinct smileys may share common image file (thus, their
- * paths will be the same).
- * Returns: (element-type PurpleSmiley) (transfer container): the list of found smileys.
-purple_smiley_parser_find(PurpleSmileyList *smileys, const gchar *message,
- * _purple_smiley_parser_init: (skip)
- * Initializes the smileys parser subsystem.
-_purple_smiley_parser_init(void);
- * _purple_smiley_parser_uninit: (skip)
- * Uninitializes the smileys parser subsystem.
-_purple_smiley_parser_uninit(void);
-#endif /* PURPLE_SMILEY_PARSER_H */
--- a/libpurple/smiley-theme.c Tue Aug 24 04:51:11 2021 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
- * 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
-#include "smiley-theme.h"
-static PurpleSmileyTheme *current = NULL;
-/*******************************************************************************
- ******************************************************************************/
-purple_smiley_theme_get_smileys(PurpleSmileyTheme *theme, gpointer ui_data)
- PurpleSmileyThemeClass *klass;
- g_return_val_if_fail(PURPLE_IS_SMILEY_THEME(theme), NULL);
- klass = PURPLE_SMILEY_THEME_GET_CLASS(theme);
- g_return_val_if_fail(klass != NULL, NULL);
- g_return_val_if_fail(klass->get_smileys != NULL, NULL);
- return klass->get_smileys(theme, ui_data);
-purple_smiley_theme_set_current(PurpleSmileyTheme *theme)
- PurpleSmileyThemeClass *klass;
- g_return_if_fail(theme == NULL || PURPLE_IS_SMILEY_THEME(theme));
- g_object_unref(current);
- klass = PURPLE_SMILEY_THEME_GET_CLASS(theme);
- g_return_if_fail(klass != NULL);
- klass->activate(theme);
-purple_smiley_theme_get_current(void)
-_purple_smiley_theme_uninit(void)
- purple_smiley_theme_set_current(NULL);
-/*******************************************************************************
- ******************************************************************************/
-purple_smiley_theme_get_type(void)
- if (G_UNLIKELY(type == 0)) {
- static const GTypeInfo info = {
- .class_size = sizeof(PurpleSmileyThemeClass),
- .instance_size = sizeof(PurpleSmileyTheme),
- type = g_type_register_static(G_TYPE_OBJECT,
- "PurpleSmileyTheme", &info, G_TYPE_FLAG_ABSTRACT);
--- a/libpurple/smiley-theme.h Tue Aug 24 04:51:11 2021 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,134 +0,0 @@
- * 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
-#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
-# error "only <purple.h> may be included directly"
-#ifndef PURPLE_SMILEY_THEME_H
-#define PURPLE_SMILEY_THEME_H
- * @include:smiley-theme.h
- * @section_id: libpurple-smiley-theme
- * @short_description: a categorized set of standard smileys
- * @title: Smiley themes
- * A smiley theme is a set of standard smileys, that may be displayed in user's
- * message window instead of their textual representations. It may be
- * categorized depending on the selected protocol, but it's up to the UI to
-#include <glib-object.h>
-#include "smiley-list.h"
- * PURPLE_TYPE_SMILEY_THEME:
- * The standard _get_type macro for #PurpleSmileyTheme.
-#define PURPLE_TYPE_SMILEY_THEME purple_smiley_theme_get_type()
- * purple_smiley_theme_get_type:
- * Returns: the #GType for a smiley list.
-G_DECLARE_DERIVABLE_TYPE(PurpleSmileyTheme, purple_smiley_theme, PURPLE,
- * PurpleSmileyThemeClass:
- * @get_smileys: a callback for getting smiley list based on choosen category.
- * The criteria for a category are being passed using the
- * @activate: a callback being fired after activating the @theme. It may be used
- * for loading its contents before using @get_smileys callback.
- * Base class for #PurpleSmileyTheme objects.
-struct _PurpleSmileyThemeClass
- GObjectClass parent_class;
- PurpleSmileyList * (*get_smileys)(PurpleSmileyTheme *theme,
- void (*activate)(PurpleSmileyTheme *theme);
- void (*purple_reserved1)(void);
- void (*purple_reserved2)(void);
- void (*purple_reserved3)(void);
- void (*purple_reserved4)(void);
- * purple_smiley_theme_get_smileys:
- * @theme: the smiley theme.
- * @ui_data: the UI-passed criteria to choose a smiley set.
- * Retrieves a smiley category based on UI-provided criteria.
- * You might want to use <link linkend="libpurple-smiley-parser">smiley
- * parser</link> instead. It's mostly for the UI, prpls shouldn't use it.
- * Returns: (transfer none): a #PurpleSmileyList with standard smileys to use.
-purple_smiley_theme_get_smileys(PurpleSmileyTheme *theme, gpointer ui_data);
- * purple_smiley_theme_set_current:
- * @theme: the smiley theme to be set as currently used. May be %NULL.
- * Sets the new smiley theme to be used for displaying messages.
-purple_smiley_theme_set_current(PurpleSmileyTheme *theme);
- * purple_smiley_theme_get_current:
- * Returns the currently used smiley theme.
- * Returns: (transfer none): the #PurpleSmileyTheme or %NULL, if none is set.
-purple_smiley_theme_get_current(void);
- * _purple_smiley_theme_uninit: (skip)
- * Uninitializes the smileys theme subsystem.
-_purple_smiley_theme_uninit(void);
-#endif /* PURPLE_SMILEY_THEME_H */
--- a/libpurple/smiley.c Tue Aug 24 04:51:11 2021 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,211 +0,0 @@
- * 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
- * A generic smiley. It can either be a theme smiley, or a custom smiley.
-static GParamSpec *properties[PROP_LAST];
-G_DEFINE_TYPE_WITH_PRIVATE(PurpleSmiley, purple_smiley, PURPLE_TYPE_IMAGE);
-/*******************************************************************************
- ******************************************************************************/
-_purple_smiley_set_shortcut(PurpleSmiley *smiley, const gchar *shortcut) {
- PurpleSmileyPrivate *priv = purple_smiley_get_instance_private(smiley);
- g_free(priv->shortcut);
- priv->shortcut = g_strdup(shortcut);
- g_object_notify(G_OBJECT(smiley), "shortcut");
-/*******************************************************************************
- ******************************************************************************/
-purple_smiley_init(PurpleSmiley *smiley) {
-purple_smiley_finalize(GObject *obj) {
- PurpleSmiley *smiley = PURPLE_SMILEY(obj);
- PurpleSmileyPrivate *priv = purple_smiley_get_instance_private(smiley);
- g_free(priv->shortcut);
- G_OBJECT_CLASS(purple_smiley_parent_class)->finalize(obj);
-purple_smiley_get_property(GObject *obj, guint param_id, GValue *value,
- PurpleSmiley *smiley = PURPLE_SMILEY(obj);
- g_value_set_string(value, purple_smiley_get_shortcut(smiley));
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
-purple_smiley_set_property(GObject *obj, guint param_id, const GValue *value,
- PurpleSmiley *smiley = PURPLE_SMILEY(obj);
- _purple_smiley_set_shortcut(smiley, g_value_get_string(value));
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
-purple_smiley_class_init(PurpleSmileyClass *klass) {
- GObjectClass *obj_class = G_OBJECT_CLASS(klass);
- obj_class->get_property = purple_smiley_get_property;
- obj_class->set_property = purple_smiley_set_property;
- obj_class->finalize = purple_smiley_finalize;
- properties[PROP_SHORTCUT] = g_param_spec_string(
- "A non-escaped textual representation of a smiley.",
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS
- g_object_class_install_properties(obj_class, PROP_LAST, properties);
-/*******************************************************************************
- ******************************************************************************/
-purple_smiley_new(const gchar *shortcut, const gchar *path)
- PurpleSmiley *smiley = NULL;
- gchar *contents = NULL;
- g_return_val_if_fail(shortcut != NULL, NULL);
- g_return_val_if_fail(path != NULL, NULL);
- if(!g_file_get_contents(path, &contents, &length, NULL)) {
- bytes = g_bytes_new_take(contents, length);
-purple_smiley_new_from_data(const gchar *shortcut,
- PurpleSmiley *smiley = NULL;
- g_return_val_if_fail(shortcut != NULL, NULL);
- bytes = g_bytes_new(data, length);
-purple_smiley_new_remote(const gchar *shortcut) {
- g_return_val_if_fail(shortcut != NULL, NULL);
-purple_smiley_get_shortcut(PurpleSmiley *smiley)
- PurpleSmileyPrivate *priv = NULL;
- g_return_val_if_fail(PURPLE_IS_SMILEY(smiley), NULL);
- priv = purple_smiley_get_instance_private(smiley);
--- a/libpurple/smiley.h Tue Aug 24 04:51:11 2021 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
- * 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
-#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
-# error "only <purple.h> may be included directly"
- * @section_id: libpurple-smiley
- * @short_description: a link between emoticon image and its textual representation
- * A #PurpleSmiley is a base class for associating emoticon images and their
- * textual representation. It's intended for various smiley-related tasks:
- * parsing the text against them, displaying in the smiley selector, or handling
- * The #PurpleSmiley:shortcut is always unescaped, but <link linkend="libpurple-smiley-parser">smiley parser</link>
- * may deal with special characters.
-#include <glib-object.h>
- * The standard _get_type macro for #PurpleSmiley.
-#define PURPLE_TYPE_SMILEY purple_smiley_get_type()
- * purple_smiley_get_type:
- * Returns: the #GType for a smiley.
-G_DECLARE_FINAL_TYPE(PurpleSmiley, purple_smiley, PURPLE, SMILEY, PurpleImage)
- * @shortcut: the smiley shortcut (unescaped).
- * @path: the smiley image file path.
- * Creates new smiley, which is ready to display (its file exists
- * and is a valid image).
- * Returns: the new #PurpleSmiley.
-PurpleSmiley *purple_smiley_new(const gchar *shortcut, const gchar *path);
- * purple_smiley_new_from_data:
- * @shortcut: The smiley shortcut (unescaped).
- * @data: The raw data of the image.
- * @length: The length of @data in bytes.
- * Creates new smiley from @data.
- * Returns: A new #PurpleSmiley.
-PurpleSmiley *purple_smiley_new_from_data(const gchar *shortcut, const guint8 *data, gsize length);
- * purple_smiley_new_remote:
- * @shortcut: the smiley shortcut (unescaped).
- * Creates new remote smiley. It's not bound to any conversation, so most
- * probably you might want to use
- * #purple_conversation_add_remote_smiley instead.
- * Returns: the new remote #PurpleSmiley.
-PurpleSmiley *purple_smiley_new_remote(const gchar *shortcut);
- * purple_smiley_get_shortcut:
- * Returns the @smiley's associated shortcut (e.g. <literal>(homer)</literal> or
- * <literal>:-)</literal>).
- * Returns: the unescaped shortcut.
-const gchar *purple_smiley_get_shortcut(PurpleSmiley *smiley);
-#endif /* PURPLE_SMILEY_H */
--- a/libpurple/tests/meson.build Tue Aug 24 04:51:11 2021 -0500
+++ b/libpurple/tests/meson.build Tue Aug 24 04:52:14 2021 -0500
@@ -11,8 +11,6 @@
--- a/libpurple/tests/test_smiley.c Tue Aug 24 04:51:11 2021 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
- * 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
-// $ cat test-image.png | hexdump -v -e '1 1 "0x%02x," " "' | xargs -n 8 echo
-static const gsize test_image_data_len = 160;
-static const guint8 test_image_data[] = {
- 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,
- 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
- 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02,
- 0x08, 0x02, 0x00, 0x00, 0x00, 0xfd, 0xd4, 0x9a,
- 0x73, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59,
- 0x73, 0x00, 0x00, 0x0b, 0x13, 0x00, 0x00, 0x0b,
- 0x13, 0x01, 0x00, 0x9a, 0x9c, 0x18, 0x00, 0x00,
- 0x00, 0x07, 0x74, 0x49, 0x4d, 0x45, 0x07, 0xe0,
- 0x0a, 0x02, 0x16, 0x30, 0x22, 0x28, 0xa4, 0xc9,
- 0xdd, 0x00, 0x00, 0x00, 0x1d, 0x69, 0x54, 0x58,
- 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x72, 0x65,
- 0x61, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74,
- 0x68, 0x20, 0x47, 0x49, 0x4d, 0x50, 0x64, 0x2e,
- 0x65, 0x07, 0x00, 0x00, 0x00, 0x16, 0x49, 0x44,
- 0x41, 0x54, 0x08, 0xd7, 0x63, 0xf8, 0xff, 0xff,
- 0x3f, 0x03, 0x03, 0x03, 0xe3, 0xb3, 0x4c, 0xb5,
- 0x9b, 0x4e, 0x0b, 0x00, 0x2f, 0xa9, 0x06, 0x2f,
- 0x8a, 0xd1, 0xc6, 0xb3, 0x00, 0x00, 0x00, 0x00,
- 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
-/******************************************************************************
- *****************************************************************************/
-_test_smiley(PurpleSmiley *smiley,
- const guint8 *adata = NULL;
- g_assert(PURPLE_IS_SMILEY(PURPLE_IMAGE(smiley)));
- bytes = purple_image_get_contents(PURPLE_IMAGE(smiley));
- adata = g_bytes_get_data(bytes, &alen);
- g_assert_cmpmem(adata, alen, edata, elen);
- purple_image_get_extension(PURPLE_IMAGE(smiley)),
- purple_image_get_mimetype(PURPLE_IMAGE(smiley)),
- g_assert_cmpstr(purple_smiley_get_shortcut(smiley), ==, shortcut);
- g_assert_cmpstr(purple_image_get_path(PURPLE_IMAGE(smiley)), ==, path);
- g_object_unref(G_OBJECT(smiley));
-/******************************************************************************
- *****************************************************************************/
-test_smiley_new_from_data(void) {
- PurpleSmiley *smiley = purple_smiley_new_from_data(
-test_smiley_new_from_file(void) {
- PurpleSmiley *smiley = NULL;
- path = g_build_filename(TEST_DATA_DIR, "test-image.png", NULL);
- smiley = purple_smiley_new("^_^", path);
- g_file_get_contents(path, &edata, &elen, &error);
- g_assert_no_error(error);
-/******************************************************************************
- *****************************************************************************/
-main(gint argc, gchar **argv) {
- g_test_init(&argc, &argv, NULL);
- g_test_set_nonfatal_assertions();
- g_test_add_func("/smiley/new-from-data", test_smiley_new_from_data);
- g_test_add_func("/smiley/new-from-file", test_smiley_new_from_file);
--- a/libpurple/tests/test_smiley_list.c Tue Aug 24 04:51:11 2021 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
- * 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
-/******************************************************************************
- *****************************************************************************/
-test_smiley_list_new(void) {
- PurpleSmileyList *list = NULL;
- list = purple_smiley_list_new();
- g_assert(purple_smiley_list_is_empty(list));
- g_assert(purple_smiley_list_get_unique(list) == NULL);
- g_assert(purple_smiley_list_get_all(list) == NULL);
- g_object_unref(G_OBJECT(list));
-test_smiley_list_add_remove(void) {
- PurpleSmileyList *list = NULL;
- PurpleSmiley *smiley = NULL, *smiley2 = NULL;
- PurpleTrie *trie = NULL;
- gboolean added = FALSE;
- list = purple_smiley_list_new();
- g_assert(purple_smiley_list_is_empty(list));
- smiley = purple_smiley_new_from_data("testing", NULL, 0);
- /* add the smiley to the list */
- added = purple_smiley_list_add(list, smiley);
- g_assert(!purple_smiley_list_is_empty(list));
- /* make sure we can get it back out */
- smiley2 = purple_smiley_list_get_by_shortcut(list, "testing");
- g_assert(smiley == smiley2);
- /* make sure it returns a valid trie */
- trie = purple_smiley_list_get_trie(list);
- g_assert(PURPLE_IS_TRIE(trie));
- /* don't free the trie, as it's ownership is not transfered to us */
- /* add it again (should fail) */
- added = purple_smiley_list_add(list, smiley);
- /* now remove it and make sure the list is empty */
- purple_smiley_list_remove(list, smiley);
- g_assert(purple_smiley_list_is_empty(list));
- g_object_unref(G_OBJECT(smiley));
- g_object_unref(G_OBJECT(list));
-/******************************************************************************
- *****************************************************************************/
-main(gint argc, gchar **argv) {
- g_test_init(&argc, &argv, NULL);
- g_test_set_nonfatal_assertions();
- g_test_add_func("/smiley_list/new", test_smiley_list_new);
- g_test_add_func("/smiley_list/add-remove", test_smiley_list_add_remove);
--- a/pidgin/gtkconv.c Tue Aug 24 04:51:11 2021 -0500
+++ b/pidgin/gtkconv.c Tue Aug 24 04:52:14 2021 -0500
@@ -104,7 +104,6 @@
PIDGIN_CONV_MENU = 1 << 2,
PIDGIN_CONV_TAB_ICON = 1 << 3,
PIDGIN_CONV_TOPIC = 1 << 4,
- PIDGIN_CONV_SMILEY_THEME = 1 << 5,
PIDGIN_CONV_COLORIZE_TITLE = 1 << 6,
@@ -4750,9 +4749,6 @@
purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline", FALSE);
purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_strike", FALSE);
purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting", TRUE);
- /* TODO: it's about *remote* smileys, not local ones */
- purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/resize_custom_smileys", TRUE);
- purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/custom_smileys_size", 96);
purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines", 2);
purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar", TRUE);
--- a/pidgin/gtksmiley-manager.c Tue Aug 24 04:51:11 2021 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,791 +0,0 @@
- * Pidgin 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
-#include <glib/gi18n-lib.h>
-#include "gtksmiley-manager.h"
-#include "pidginstock.h"
-#include <libsoup/soup.h>
- PurpleImage *new_image;
- SMILEY_LIST_MODEL_ICON,
- SMILEY_LIST_MODEL_SHORTCUT,
- SMILEY_LIST_MODEL_PURPLESMILEY,
- SMILEY_LIST_MODEL_N_COL
-static SmileyManager *smiley_manager = NULL;
-edit_dialog_update_buttons(SmileyEditDialog *edit_dialog);
-manager_list_fill(SmileyManager *manager);
-/*******************************************************************************
- * Custom smiley edit dialog image.
- ******************************************************************************/
-edit_dialog_image_update_thumb(SmileyEditDialog *edit_dialog)
- GdkPixbuf *pixbuf = NULL;
- if (edit_dialog->new_image) {
- pixbuf = pidgin_pixbuf_from_image(edit_dialog->new_image);
- } else if (edit_dialog->filename) {
- pixbuf = pidgin_pixbuf_new_from_file(edit_dialog->filename);
- g_free(edit_dialog->filename);
- edit_dialog->filename = NULL;
- pixbuf = pidgin_pixbuf_scale_down(pixbuf, 64, 64,
- GDK_INTERP_HYPER, TRUE);
- GtkIconSize icon_size =
- gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_SMALL);
- pixbuf = gtk_widget_render_icon(GTK_WIDGET(edit_dialog->window),
- PIDGIN_STOCK_TOOLBAR_SELECT_AVATAR, icon_size,
- "PidginSmileyManager");
- g_return_if_fail(pixbuf != NULL);
- gtk_image_set_from_pixbuf(GTK_IMAGE(edit_dialog->thumbnail), pixbuf);
- g_object_unref(G_OBJECT(pixbuf));
-edit_dialog_set_image(SmileyEditDialog *edit_dialog, PurpleImage *image)
- if (edit_dialog->new_image)
- g_object_unref(edit_dialog->new_image);
- if (edit_dialog->smiley) {
- g_object_set_data(G_OBJECT(edit_dialog->smiley),
- "pidgin-smiley-manager-list-thumb", NULL);
- /* check, if image is valid */
- tmp = pidgin_pixbuf_from_image(image);
- edit_dialog->new_image = image;
- edit_dialog_image_update_thumb(edit_dialog);
- edit_dialog_update_buttons(edit_dialog);
- return (image != NULL);
-edit_dialog_set_shortcut(SmileyEditDialog *edit_dialog,
- gtk_entry_set_text(edit_dialog->shortcut, shortcut ? shortcut : "");
-edit_dialog_image_choosen(const char *filename, gpointer _edit_dialog)
- SmileyEditDialog *edit_dialog = _edit_dialog;
- image = purple_image_new_from_file(filename, NULL);
- g_free(edit_dialog->filename);
- edit_dialog->filename = NULL;
- if (!edit_dialog_set_image(edit_dialog, image))
- edit_dialog->filename = g_strdup(filename);
- gtk_widget_grab_focus(GTK_WIDGET(edit_dialog->shortcut));
-edit_dialog_image_choose(GtkWidget *widget, gpointer _edit_dialog)
- GtkFileChooserNative *file_chooser;
- file_chooser = pidgin_buddy_icon_chooser_new(
- GTK_WINDOW(gtk_widget_get_toplevel(widget)),
- edit_dialog_image_choosen, _edit_dialog);
- gtk_window_set_title(GTK_WINDOW(file_chooser), _("Custom Smiley"));
- gtk_window_set_role(GTK_WINDOW(file_chooser),
- "file-selector-custom-smiley");
- gtk_native_dialog_run(GTK_NATIVE_DIALOG(file_chooser));
- g_object_unref(file_chooser);
-/*******************************************************************************
- * Custom smiley edit dialog.
- ******************************************************************************/
-edit_dialog_destroy(GtkWidget *window, gpointer _edit_dialog)
- SmileyEditDialog *edit_dialog = _edit_dialog;
- if (edit_dialog->smiley) {
- g_object_set_data(G_OBJECT(edit_dialog->smiley),
- "pidgin-smiley-manager-edit-dialog", NULL);
- g_object_unref(edit_dialog->smiley);
- if (edit_dialog->new_image)
- g_object_unref(edit_dialog->new_image);
- g_free(edit_dialog->filename);
-edit_dialog_save(SmileyEditDialog *edit_dialog)
- PurpleSmiley *existing_smiley;
- gboolean shortcut_changed, image_changed;
- shortcut = gtk_entry_get_text(edit_dialog->shortcut);
- existing_smiley = purple_smiley_list_get_by_shortcut(
- purple_smiley_custom_get_list(), shortcut);
- if (existing_smiley && existing_smiley != edit_dialog->smiley) {
- gchar *msg = g_strdup_printf(
- _("A custom smiley for '%s' already exists. "
- "Please use a different shortcut."), shortcut);
- purple_notify_error(edit_dialog, _("Custom Smiley"),
- _("Duplicate Shortcut"), msg, NULL);
- if (edit_dialog->smiley == NULL)
- shortcut_changed = image_changed = TRUE;
- shortcut_changed = purple_strequal(purple_smiley_get_shortcut(
- edit_dialog->smiley), shortcut);
- image_changed = (edit_dialog->new_image != NULL);
- if (!shortcut_changed && !image_changed) {
- gtk_widget_destroy(GTK_WIDGET(edit_dialog->window));
- if (edit_dialog->new_image == NULL) {
- edit_dialog->new_image = PURPLE_IMAGE(edit_dialog->smiley);
- g_return_if_fail(edit_dialog->new_image);
- if (edit_dialog->smiley)
- purple_smiley_custom_remove(edit_dialog->smiley);
- purple_smiley_custom_add(edit_dialog->new_image, shortcut);
- manager_list_fill(smiley_manager);
- gtk_widget_destroy(GTK_WIDGET(edit_dialog->window));
-edit_dialog_update_buttons(SmileyEditDialog *edit_dialog)
- gboolean shortcut_ok, image_ok;
- shortcut_ok = (gtk_entry_get_text_length(edit_dialog->shortcut) > 0);
- image_ok = (edit_dialog->filename || edit_dialog->new_image);
- gtk_dialog_set_response_sensitive(edit_dialog->window,
- GTK_RESPONSE_ACCEPT, shortcut_ok && image_ok);
-edit_dialog_shortcut_changed(GtkEditable *shortcut, gpointer _edit_dialog)
- SmileyEditDialog *edit_dialog = _edit_dialog;
- edit_dialog_update_buttons(edit_dialog);
-edit_dialog_response(GtkDialog *window, gint response_id,
- SmileyEditDialog *edit_dialog = _edit_dialog;
- case GTK_RESPONSE_ACCEPT:
- edit_dialog_save(edit_dialog);
- case GTK_RESPONSE_DELETE_EVENT:
- case GTK_RESPONSE_CANCEL:
- gtk_widget_destroy(GTK_WIDGET(edit_dialog->window));
-static SmileyEditDialog *
-edit_dialog_show(SmileyManager *manager, PurpleSmiley *smiley)
- SmileyEditDialog *edit_dialog;
- GtkWidget *vbox, *hbox;
- edit_dialog = g_object_get_data(G_OBJECT(smiley),
- "pidgin-smiley-manager-edit-dialog");
- gtk_window_present(GTK_WINDOW(edit_dialog->window));
- edit_dialog = g_new0(SmileyEditDialog, 1);
- edit_dialog->window = GTK_DIALOG(gtk_dialog_new_with_buttons(
- smiley ? _("Edit Smiley") : _("Add Smiley"),
- manager ? GTK_WINDOW(manager->window) : NULL,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- _("Cancel"), GTK_RESPONSE_CANCEL,
- smiley ? _("Save") : _("Add"), GTK_RESPONSE_ACCEPT,
- gtk_dialog_set_default_response(
- edit_dialog->window, GTK_RESPONSE_ACCEPT);
- edit_dialog->smiley = smiley;
- g_object_set_data(G_OBJECT(smiley),
- "pidgin-smiley-manager-edit-dialog", edit_dialog);
- gtk_grid_set_row_spacing(GTK_GRID(vbox), 12);
- gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(
- edit_dialog->window)), vbox);
- gtk_grid_set_column_spacing(GTK_GRID(hbox), 12);
- gtk_grid_attach(GTK_GRID(vbox), hbox, 0, 0, 1, 1);
- label = GTK_LABEL(gtk_label_new_with_mnemonic(_("_Image:")));
- gtk_grid_attach(GTK_GRID(hbox), GTK_WIDGET(label), 0, 0, 1, 1);
- gtk_widget_show(GTK_WIDGET(label));
- filech = GTK_BUTTON(gtk_button_new());
- gtk_grid_attach_next_to(GTK_GRID(hbox), GTK_WIDGET(filech), NULL,
- pidgin_set_accessible_label(GTK_WIDGET(filech), label);
- edit_dialog->thumbnail = GTK_IMAGE(gtk_image_new());
- gtk_container_add(GTK_CONTAINER(filech),
- GTK_WIDGET(edit_dialog->thumbnail));
- gtk_widget_show_all(hbox);
- gtk_grid_set_column_spacing(GTK_GRID(hbox), 12);
- gtk_grid_attach_next_to(GTK_GRID(vbox), hbox, NULL,
- label = GTK_LABEL(gtk_label_new_with_mnemonic(_("S_hortcut text:")));
- gtk_grid_attach(GTK_GRID(hbox), GTK_WIDGET(label), 0, 0, 1, 1);
- gtk_widget_show(GTK_WIDGET(label));
- edit_dialog->shortcut = GTK_ENTRY(gtk_entry_new());
- gtk_entry_set_activates_default(edit_dialog->shortcut, TRUE);
- pidgin_set_accessible_label(GTK_WIDGET(edit_dialog->shortcut), label);
- gtk_grid_attach_next_to(GTK_GRID(hbox),
- GTK_WIDGET(edit_dialog->shortcut), NULL, GTK_POS_RIGHT, 1, 1);
- gtk_widget_show(GTK_WIDGET(edit_dialog->shortcut));
- gtk_widget_show(GTK_WIDGET(edit_dialog->window));
- edit_dialog->filename = g_strdup(purple_image_get_path(
- PURPLE_IMAGE(smiley)));
- gtk_entry_set_text(edit_dialog->shortcut,
- purple_smiley_get_shortcut(smiley));
- edit_dialog_image_update_thumb(edit_dialog);
- edit_dialog_update_buttons(edit_dialog);
- g_signal_connect(edit_dialog->window, "response",
- G_CALLBACK(edit_dialog_response), edit_dialog);
- g_signal_connect(filech, "clicked",
- G_CALLBACK(edit_dialog_image_choose), edit_dialog);
- g_signal_connect(edit_dialog->shortcut, "changed",
- G_CALLBACK(edit_dialog_shortcut_changed), edit_dialog);
- g_signal_connect(edit_dialog->window, "destroy",
- G_CALLBACK(edit_dialog_destroy), edit_dialog);
- g_signal_connect(edit_dialog->window, "destroy",
- G_CALLBACK(purple_notify_close_with_handle), edit_dialog);
-pidgin_smiley_manager_add(PurpleImage *image, const gchar *shortcut)
- SmileyEditDialog *edit_dialog;
- g_return_if_fail(image != NULL);
- edit_dialog = edit_dialog_show(NULL, NULL);
- edit_dialog_set_shortcut(edit_dialog, shortcut);
- if (!edit_dialog_set_image(edit_dialog, image))
- gtk_widget_destroy(GTK_WIDGET(edit_dialog->window));
-/*******************************************************************************
- * Custom smiley list Drag-and-drop support.
- ******************************************************************************/
-smiley_list_dnd_url_got(G_GNUC_UNUSED SoupSession *session, SoupMessage *msg,
- SmileyManager *manager = _manager;
- SmileyEditDialog *edit_dialog;
- g_return_if_fail(manager == smiley_manager);
- if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) {
- image = purple_image_new_from_data((const guint8 *)msg->response_body->data,
- msg->response_body->length);
- edit_dialog = edit_dialog_show(manager, NULL);
- if (!edit_dialog_set_image(edit_dialog, image))
- gtk_widget_destroy(GTK_WIDGET(edit_dialog->window));
-smiley_list_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y,
- GtkSelectionData *sd, guint info, guint time, gpointer _manager)
- SmileyManager *manager = _manager;
- /* We don't need anything, that is not 8-bit per element (char). */
- if (gtk_selection_data_get_format(sd) != 8) {
- gtk_drag_finish(dc, FALSE, FALSE, time);
- if (gtk_selection_data_get_length(sd) <= 0) {
- gtk_drag_finish(dc, FALSE, FALSE, time);
- memset(&content, 0, sizeof(content));
- memcpy(&content, gtk_selection_data_get_data(sd),
- MIN((guint)gtk_selection_data_get_length(sd), sizeof(content)));
- if (content[0] == '\0') {
- gtk_drag_finish(dc, FALSE, FALSE, time);
- /* Well, it looks like the drag event was cool.
- * Let's do something with it */
- if (purple_str_has_caseprefix(content, "file://")) {
- SmileyEditDialog *edit_dialog;
- filename = g_filename_from_uri(content, NULL, NULL);
- if (!filename || !g_file_test(filename, G_FILE_TEST_EXISTS)) {
- purple_debug_warning("gtksmiley-manager",
- "dropped file does not exists");
- gtk_drag_finish(dc, FALSE, FALSE, time);
- image = purple_image_new_from_file(filename, NULL);
- purple_debug_warning("gtksmiley-manager",
- "dropped file is not a valid image");
- gtk_drag_finish(dc, FALSE, FALSE, time);
- edit_dialog = edit_dialog_show(manager, NULL);
- if (!edit_dialog_set_image(edit_dialog, image)) {
- gtk_widget_destroy(GTK_WIDGET(edit_dialog->window));
- gtk_drag_finish(dc, FALSE, FALSE, time);
- gtk_drag_finish(dc, TRUE, FALSE, time);
- if (purple_str_has_caseprefix(content, "http://") ||
- purple_str_has_caseprefix(content, "https://"))
- if (smiley_manager->session == NULL) {
- smiley_manager->session = soup_session_new();
- soup_session_abort(smiley_manager->session);
- msg = soup_message_new("GET", content);
- soup_session_queue_message(smiley_manager->session, msg,
- smiley_list_dnd_url_got, manager);
- gtk_drag_finish(dc, TRUE, FALSE, time);
- gtk_drag_finish(dc, FALSE, FALSE, time);
-/*******************************************************************************
- ******************************************************************************/
-smiley_list_selected(GtkTreeSelection *sel, gpointer _manager)
- SmileyManager *manager = _manager;
- sens = (gtk_tree_selection_count_selected_rows(sel) > 0);
- gtk_dialog_set_response_sensitive(manager->window,
- GTK_RESPONSE_NO, sens);
- gtk_dialog_set_response_sensitive(manager->window,
- PIDGIN_RESPONSE_MODIFY, sens);
-smiley_list_activated(GtkTreeView *tree, GtkTreePath *path,
- GtkTreeViewColumn *col, gpointer _manager)
- SmileyManager *manager = _manager;
- PurpleSmiley *smiley = NULL;
- if (!gtk_tree_model_get_iter(
- GTK_TREE_MODEL(manager->model), &iter, path))
- gtk_tree_model_get(GTK_TREE_MODEL(manager->model), &iter,
- SMILEY_LIST_MODEL_PURPLESMILEY, &smiley, -1);
- g_return_if_fail(PURPLE_IS_SMILEY(smiley));
- edit_dialog_show(manager, smiley);
-manager_list_add(SmileyManager *manager, PurpleSmiley *smiley)
- GdkPixbuf *smiley_image;
- smiley_image = g_object_get_data(G_OBJECT(smiley),
- "pidgin-smiley-manager-list-thumb");
- if (smiley_image == NULL) {
- smiley_image = pidgin_pixbuf_from_image(PURPLE_IMAGE(smiley));
- smiley_image = pidgin_pixbuf_scale_down(smiley_image,
- 22, 22, GDK_INTERP_BILINEAR, TRUE);
- g_object_set_data_full(G_OBJECT(smiley),
- "pidgin-smiley-manager-list-thumb",
- smiley_image, g_object_unref);
- gtk_list_store_append(manager->model, &iter);
- gtk_list_store_set(manager->model, &iter,
- SMILEY_LIST_MODEL_ICON, smiley_image,
- SMILEY_LIST_MODEL_SHORTCUT, purple_smiley_get_shortcut(smiley),
- SMILEY_LIST_MODEL_PURPLESMILEY, smiley,
-manager_list_fill(SmileyManager *manager)
- GList *custom_smileys, *it;
- gtk_list_store_clear(manager->model);
- custom_smileys = purple_smiley_list_get_all(
- purple_smiley_custom_get_list());
- for (it = custom_smileys; it; it = g_list_next(it)) {
- PurpleSmiley *smiley = it->data;
- manager_list_add(manager, smiley);
- g_list_free(custom_smileys);
-manager_list_create(SmileyManager *manager)
- GtkCellRenderer *cellrend;
- GtkTreeViewColumn *column;
- GtkTargetEntry targets[3] = {
- {"text/uri-list", 0, 1},
- manager->model = gtk_list_store_new(SMILEY_LIST_MODEL_N_COL,
- GDK_TYPE_PIXBUF, /* icon */
- G_TYPE_STRING, /* shortcut */
- G_TYPE_OBJECT /* PurpleSmiley */
- manager->tree = tree = GTK_TREE_VIEW(gtk_tree_view_new_with_model(
- GTK_TREE_MODEL(manager->model)));
- gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(manager->model),
- SMILEY_LIST_MODEL_SHORTCUT, GTK_SORT_ASCENDING);
- g_object_unref(manager->model);
- sel = gtk_tree_view_get_selection(tree);
- gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE);
- g_signal_connect(sel, "changed",
- G_CALLBACK(smiley_list_selected), manager);
- g_signal_connect(tree, "row-activated",
- G_CALLBACK(smiley_list_activated), manager);
- gtk_drag_dest_set(GTK_WIDGET(tree), GTK_DEST_DEFAULT_MOTION |
- GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP,
- targets, G_N_ELEMENTS(targets),
- GDK_ACTION_COPY | GDK_ACTION_MOVE);
- g_signal_connect(tree, "drag-data-received",
- G_CALLBACK(smiley_list_dnd_recv), manager);
- gtk_widget_show(GTK_WIDGET(tree));
- /* setting up columns */
- column = gtk_tree_view_column_new();
- gtk_tree_view_column_set_title(column, _("Smiley"));
- gtk_tree_view_column_set_resizable(column, TRUE);
- gtk_tree_view_append_column(tree, column);
- cellrend = gtk_cell_renderer_pixbuf_new();
- gtk_tree_view_column_pack_start(column, cellrend, FALSE);
- gtk_tree_view_column_add_attribute(column, cellrend,
- "pixbuf", SMILEY_LIST_MODEL_ICON);
- column = gtk_tree_view_column_new();
- gtk_tree_view_column_set_title(column, _("Shortcut Text"));
- gtk_tree_view_column_set_resizable(column, TRUE);
- gtk_tree_view_append_column(tree, column);
- cellrend = gtk_cell_renderer_text_new();
- gtk_tree_view_column_pack_start(column, cellrend, TRUE);
- gtk_tree_view_column_add_attribute(column, cellrend,
- "text", SMILEY_LIST_MODEL_SHORTCUT);
- manager_list_fill(manager);
- return pidgin_make_scrollable(GTK_WIDGET(tree), GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC, GTK_SHADOW_IN, -1, -1);
-/*******************************************************************************
- * Custom smiley manager window.
- ******************************************************************************/
-manager_select_cb(GtkWidget *widget, gint resp, SmileyManager *manager)
- GtkTreeSelection *selection = NULL;
- GList *selected_rows, *selected_smileys = NULL, *it;
- GtkTreeModel *model = GTK_TREE_MODEL(manager->model);
- selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(manager->tree));
- selected_rows = gtk_tree_selection_get_selected_rows(selection, NULL);
- for (it = selected_rows; it; it = g_list_next(it)) {
- GtkTreePath *path = it->data;
- PurpleSmiley *smiley = NULL;
- if (!gtk_tree_model_get_iter(model, &iter, path))
- gtk_tree_model_get(model, &iter,
- SMILEY_LIST_MODEL_PURPLESMILEY, &smiley, -1);
- selected_smileys = g_list_prepend(selected_smileys, smiley);
- g_list_free_full(selected_rows, (GDestroyNotify)gtk_tree_path_free);
- edit_dialog_show(manager, NULL);
- for (it = selected_smileys; it; it = g_list_next(it))
- purple_smiley_custom_remove(it->data);
- manager_list_fill(manager);
- case GTK_RESPONSE_DELETE_EVENT:
- case GTK_RESPONSE_CLOSE:
- gtk_widget_destroy(GTK_WIDGET(manager->window));
- soup_session_abort(manager->session);
- g_clear_object(&manager->session);
- case PIDGIN_RESPONSE_MODIFY:
- for (it = selected_smileys; it; it = g_list_next(it))
- edit_dialog_show(manager, it->data);
- g_list_free(selected_smileys);
-pidgin_smiley_manager_show(void)
- SmileyManager *manager;
- gtk_window_present(GTK_WINDOW(smiley_manager->window));
- manager = g_new0(SmileyManager, 1);
- smiley_manager = manager;
- manager->window = win = GTK_DIALOG(gtk_dialog_new_with_buttons(
- _("Custom Smiley Manager"), NULL,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- PIDGIN_STOCK_ADD, GTK_RESPONSE_YES,
- PIDGIN_STOCK_MODIFY, PIDGIN_RESPONSE_MODIFY,
- _("Delete"), GTK_RESPONSE_NO,
- _("Close"), GTK_RESPONSE_CLOSE,
- gtk_window_set_default_size(GTK_WINDOW(win), 50, 400);
- gtk_window_set_role(GTK_WINDOW(win), "custom_smiley_manager");
- gtk_dialog_set_response_sensitive(win, GTK_RESPONSE_NO, FALSE);
- gtk_dialog_set_response_sensitive(win, PIDGIN_RESPONSE_MODIFY, FALSE);
- g_signal_connect(win, "response",
- G_CALLBACK(manager_select_cb), manager);
- vbox = gtk_dialog_get_content_area(win);
- /* get the scrolled window with all stuff */
- sw = manager_list_create(manager);
- gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
- gtk_widget_show(GTK_WIDGET(win));
--- a/pidgin/gtksmiley-manager.h Tue Aug 24 04:51:11 2021 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
- * Pidgin 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
-#if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION)
-# error "only <pidgin.h> may be included directly"
-#ifndef _PIDGIN_SMILEY_MANAGER_H_
-#define _PIDGIN_SMILEY_MANAGER_H_
- * SECTION:gtksmiley-manager
- * @include:gtksmiley-manager.h
- * @section_id: pidgin-smiley-manager
- * @short_description: a UI for user-defined smileys management
- * @title: Custom smileys manager
- * This module provides a GTK+ UI that allows the user adding and removing
- * custom smileys. See libpurple-smiley-custom section (TODO: how to link this
- * to libpurple's docs?).
- * pidgin_smiley_manager_show:
- * Creates and shows the smiley manager window, or requests focus for it,
- * if it's already opened.
-pidgin_smiley_manager_show(void);
- * pidgin_smiley_manager_add:
- * @image: the image for a new smiley.
- * @shortcut: the textual representation, may be %NULL.
- * Creates and shows the new dialog for adding a new custom smiley with
-pidgin_smiley_manager_add(PurpleImage *image, const gchar *shortcut);
-#endif /* _PIDGIN_SMILEY_MANAGER_H_ */
--- a/pidgin/gtksmiley-theme.c Tue Aug 24 04:51:11 2021 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,631 +0,0 @@
- * Pidgin 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
-#include <glib/gstdio.h>
-#include "gtksmiley-theme.h"
-#define PIDGIN_SMILEY_THEME_MAX_LINES 1024
-#define PIDGIN_SMILEY_THEME_MAX_TOKENS 1024
- * An implementation of a smiley theme.
-struct _PidginSmileyTheme
- PurpleSmileyTheme parent;
- GdkPixbuf *icon_pixbuf;
- GHashTable *smiley_lists_map;
-} PidginSmileyThemePrivate;
-static gchar **probe_dirs;
-static GList *smiley_themes = NULL;
-} PidginSmileyThemeIndex;
-} PidginSmileyThemeIndexProtocol;
-} PidginSmileyThemeIndexSmiley;
-G_DEFINE_TYPE_WITH_PRIVATE(PidginSmileyTheme, pidgin_smiley_theme,
- PURPLE_TYPE_SMILEY_THEME);
-/*******************************************************************************
- ******************************************************************************/
-pidgin_smiley_theme_index_smiley_free(PidginSmileyThemeIndexSmiley *smiley)
- g_return_if_fail(smiley != NULL);
- g_list_free_full(smiley->shortcuts, g_free);
-pidgin_smiley_theme_index_protocol_free(PidginSmileyThemeIndexProtocol *proto)
- g_return_if_fail(proto != NULL);
- g_list_free_full(proto->smileys, (GDestroyNotify)pidgin_smiley_theme_index_smiley_free);
-pidgin_smiley_theme_index_free(PidginSmileyThemeIndex *index)
- g_return_if_fail(index != NULL);
- g_list_free_full(index->protocols, (GDestroyNotify)pidgin_smiley_theme_index_protocol_free);
-static PidginSmileyThemeIndex *
-pidgin_smiley_theme_index_parse(const gchar *theme_path, gboolean load_contents)
- PidginSmileyThemeIndex *index;
- PidginSmileyThemeIndexProtocol *proto = NULL;
- gboolean inv_frm = FALSE;
- index_path = g_build_filename(theme_path, "theme", NULL);
- file = g_fopen(index_path, "r");
- purple_debug_error("gtksmiley-theme",
- "Failed to open index file %s", index_path);
- index = g_new0(PidginSmileyThemeIndex, 1);
- PidginSmileyThemeIndexSmiley *smiley;
- if (++line_no > PIDGIN_SMILEY_THEME_MAX_LINES) {
- purple_debug_warning("gtksmiley-theme", "file too big");
- if (!fgets(buff, sizeof(buff), file))
- if (!g_utf8_validate(buff, -1, NULL)) {
- purple_debug_error("gtksmiley-theme",
- "%s:%d is invalid UTF-8",
- end = strchr(line, ']');
- proto->smileys = g_list_reverse(proto->smileys);
- proto = g_new0(PidginSmileyThemeIndexProtocol, 1);
- proto->name = g_strndup(line, end - line);
- g_list_prepend(index->protocols, proto);
- if ((eqchr = strchr(line, '='))) {
- if (g_ascii_strcasecmp(line, "name") == 0) {
- index->name = g_strdup(eqchr + 1);
- g_strchug(index->name);
- } else if (g_ascii_strcasecmp(line, "description") == 0) {
- index->desc = g_strdup(eqchr + 1);
- g_strchug(index->desc);
- } else if (g_ascii_strcasecmp(line, "icon") == 0) {
- index->icon = g_strdup(eqchr + 1);
- g_strchug(index->icon);
- } else if (g_ascii_strcasecmp(line, "author") == 0) {
- index->author = g_strdup(eqchr + 1);
- g_strchug(index->author);
- /* parsing section content */
- smiley = g_new0(PidginSmileyThemeIndexSmiley, 1);
- proto->smileys = g_list_prepend(proto->smileys, smiley);
- smiley->hidden = FALSE;
- split = g_strsplit_set(line, " \t",
- PIDGIN_SMILEY_THEME_MAX_TOKENS);
- for (i = 0; split[i]; i++) {
- gchar *token = split[i];
- if (i == PIDGIN_SMILEY_THEME_MAX_TOKENS - 1)
- smiley->file = g_strdup(token);
- smiley->shortcuts = g_list_prepend(smiley->shortcuts,
- smiley->shortcuts = g_list_reverse(smiley->shortcuts);
- proto->smileys = g_list_reverse(proto->smileys);
- purple_debug_error("gtksmiley-theme", "%s:%d"
- " invalid format", index_path, line_no);
- pidgin_smiley_theme_index_free(index);
-/*******************************************************************************
- ******************************************************************************/
-pidgin_smiley_theme_load(const gchar *theme_path)
- PidginSmileyTheme *theme;
- PidginSmileyThemePrivate *priv;
- PidginSmileyThemeIndex *index;
- /* it's not super-efficient, but we don't expect huge amount of
- for (it = smiley_themes; it; it = g_list_next(it)) {
- PidginSmileyThemePrivate *priv =
- pidgin_smiley_theme_get_instance_private(it->data);
- /* theme is already loaded */
- if (g_strcmp0(priv->path, theme_path) == 0)
- theme = g_object_new(PIDGIN_TYPE_SMILEY_THEME, NULL);
- priv = pidgin_smiley_theme_get_instance_private(theme);
- priv->path = g_strdup(theme_path);
- index = pidgin_smiley_theme_index_parse(theme_path, FALSE);
- if (!index->name || index->name[0] == '\0') {
- purple_debug_warning("gtksmiley-theme",
- "incomplete theme %s", theme_path);
- pidgin_smiley_theme_index_free(index);
- priv->name = g_strdup(index->name);
- if (index->desc && index->desc[0])
- priv->desc = g_strdup(index->desc);
- if (index->icon && index->icon[0])
- priv->icon = g_strdup(index->icon);
- if (index->author && index->author[0])
- priv->author = g_strdup(index->author);
- pidgin_smiley_theme_index_free(index);
- smiley_themes = g_list_append(smiley_themes, theme);
-pidgin_smiley_theme_probe(void)
- /* remove non-existing themes */
- for (it = smiley_themes; it; it = next) {
- PidginSmileyTheme *theme = it->data;
- PidginSmileyThemePrivate *priv =
- pidgin_smiley_theme_get_instance_private(theme);
- next = g_list_next(it);
- if (g_file_test(priv->path, G_FILE_TEST_EXISTS))
- smiley_themes = g_list_delete_link(smiley_themes, it);
- for (i = 0; probe_dirs[i]; i++) {
- GDir *dir = g_dir_open(probe_dirs[i], 0, NULL);
- const gchar *theme_dir_name;
- while ((theme_dir_name = g_dir_read_name(dir))) {
- /* Ignore Pidgin 2.x.y "none" theme. */
- if (g_strcmp0(theme_dir_name, "none") == 0)
- theme_path = g_build_filename(
- probe_dirs[i], theme_dir_name, NULL);
- if (g_file_test(theme_path, G_FILE_TEST_IS_DIR))
- pidgin_smiley_theme_load(theme_path);
-/*******************************************************************************
- ******************************************************************************/
-pidgin_smiley_theme_get_name(PidginSmileyTheme *theme)
- PidginSmileyThemePrivate *priv = NULL;
- g_return_val_if_fail(PIDGIN_IS_SMILEY_THEME(theme), NULL);
- priv = pidgin_smiley_theme_get_instance_private(theme);
-pidgin_smiley_theme_get_description(PidginSmileyTheme *theme)
- PidginSmileyThemePrivate *priv = NULL;
- g_return_val_if_fail(PIDGIN_IS_SMILEY_THEME(theme), NULL);
- priv = pidgin_smiley_theme_get_instance_private(theme);
-pidgin_smiley_theme_get_icon(PidginSmileyTheme *theme)
- PidginSmileyThemePrivate *priv = NULL;
- g_return_val_if_fail(PIDGIN_IS_SMILEY_THEME(theme), NULL);
- priv = pidgin_smiley_theme_get_instance_private(theme);
- if (priv->icon == NULL)
- if (!priv->icon_pixbuf) {
- gchar *icon_path = g_build_filename(
- priv->path, priv->icon, NULL);
- priv->icon_pixbuf = pidgin_pixbuf_new_from_file(icon_path);
- return priv->icon_pixbuf;
-pidgin_smiley_theme_get_author(PidginSmileyTheme *theme)
- PidginSmileyThemePrivate *priv = NULL;
- g_return_val_if_fail(PIDGIN_IS_SMILEY_THEME(theme), NULL);
- priv = pidgin_smiley_theme_get_instance_private(theme);
-pidgin_smiley_theme_for_conv(PurpleConversation *conv)
- PurpleAccount *acc = NULL;
- PurpleSmileyTheme *theme;
- const gchar *proto_name = NULL;
- theme = purple_smiley_theme_get_current();
- acc = purple_conversation_get_account(conv);
- proto_name = purple_account_get_protocol_name(acc);
- return purple_smiley_theme_get_smileys(theme, (gpointer)proto_name);
-pidgin_smiley_theme_activate_impl(PurpleSmileyTheme *theme)
- PidginSmileyThemePrivate *priv =
- pidgin_smiley_theme_get_instance_private(
- PIDGIN_SMILEY_THEME(theme));
- PidginSmileyThemeIndex *index;
- if (priv->smiley_lists_map)
- priv->smiley_lists_map = smap = g_hash_table_new_full(
- g_str_hash, g_str_equal, g_free, g_object_unref);
- index = pidgin_smiley_theme_index_parse(priv->path, TRUE);
- for (it = index->protocols; it; it = g_list_next(it)) {
- PidginSmileyThemeIndexProtocol *proto_idx = it->data;
- PurpleSmileyList *proto_smileys;
- proto_smileys = g_hash_table_lookup(smap, proto_idx->name);
- proto_smileys = purple_smiley_list_new();
- g_hash_table_insert(smap,
- g_strdup(proto_idx->name), proto_smileys);
- for (it2 = proto_idx->smileys; it2; it2 = g_list_next(it2)) {
- PidginSmileyThemeIndexSmiley *smiley_idx = it2->data;
- smiley_path = g_build_filename(
- priv->path, smiley_idx->file, NULL);
- if (!g_file_test(smiley_path, G_FILE_TEST_EXISTS)) {
- purple_debug_warning("gtksmiley-theme",
- "Smiley %s is missing", smiley_path);
- for (it3 = smiley_idx->shortcuts; it3;
- it3 = g_list_next(it3))
- gchar *shortcut = it3->data;
- smiley = purple_smiley_new(
- shortcut, smiley_path);
- g_object_set_data(G_OBJECT(smiley),
- "pidgin-smiley-hidden",
- GINT_TO_POINTER(smiley_idx->hidden));
- purple_smiley_list_add(proto_smileys, smiley);
- g_object_unref(smiley);
- pidgin_smiley_theme_index_free(index);
-static PurpleSmileyList *
-pidgin_smiley_theme_get_smileys_impl(PurpleSmileyTheme *theme, gpointer ui_data)
- PidginSmileyThemePrivate *priv =
- pidgin_smiley_theme_get_instance_private(
- PIDGIN_SMILEY_THEME(theme));
- PurpleSmileyList *smileys = NULL;
- pidgin_smiley_theme_activate_impl(theme);
- smileys = g_hash_table_lookup(priv->smiley_lists_map, ui_data);
- return g_hash_table_lookup(priv->smiley_lists_map, "default");
-pidgin_smiley_theme_get_all(void)
- pidgin_smiley_theme_probe();
-_pidgin_smiley_theme_init(void)
- const gchar *user_smileys_dir;
- const gchar *theme_name;
- probe_dirs = g_new0(gchar*, 3);
- probe_dirs[0] = g_build_filename(
- PURPLE_DATADIR, "pixmaps", "pidgin", "emotes", NULL);
- user_smileys_dir = probe_dirs[1] =
- g_build_filename(purple_data_dir(), "smileys", NULL);
- if (!g_file_test(user_smileys_dir, G_FILE_TEST_IS_DIR)) {
- if (g_mkdir(user_smileys_dir, S_IRUSR | S_IWUSR | S_IXUSR) == 0) {
- purple_debug_error("gtksmiley-theme",
- "Failed to create user smileys dir");
- /* setting theme by name (copy-paste from gtkprefs) */
- pidgin_smiley_theme_probe();
- theme_name = purple_prefs_get_string(
- PIDGIN_PREFS_ROOT "/smileys/theme");
- for (it = smiley_themes; it; it = g_list_next(it)) {
- PidginSmileyTheme *theme = it->data;
- if (g_strcmp0(pidgin_smiley_theme_get_name(theme), theme_name))
- purple_smiley_theme_set_current(PURPLE_SMILEY_THEME(theme));
-_pidgin_smiley_theme_uninit(void)
- g_strfreev(probe_dirs);
-/*******************************************************************************
- ******************************************************************************/
-pidgin_smiley_theme_finalize(GObject *obj)
- PidginSmileyThemePrivate *priv =
- pidgin_smiley_theme_get_instance_private(
- PIDGIN_SMILEY_THEME(obj));
- g_object_unref(priv->icon_pixbuf);
- if (priv->smiley_lists_map)
- g_hash_table_destroy(priv->smiley_lists_map);
- G_OBJECT_CLASS(pidgin_smiley_theme_parent_class)->finalize(obj);
-pidgin_smiley_theme_class_init(PidginSmileyThemeClass *klass)
- GObjectClass *gobj_class = G_OBJECT_CLASS(klass);
- PurpleSmileyThemeClass *pst_class = PURPLE_SMILEY_THEME_CLASS(klass);
- gobj_class->finalize = pidgin_smiley_theme_finalize;
- pst_class->get_smileys = pidgin_smiley_theme_get_smileys_impl;
- pst_class->activate = pidgin_smiley_theme_activate_impl;
-pidgin_smiley_theme_init(PidginSmileyTheme *theme)
--- a/pidgin/gtksmiley-theme.h Tue Aug 24 04:51:11 2021 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
- * Pidgin 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
-#if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION)
-# error "only <pidgin.h> may be included directly"
-#ifndef _PIDGIN_SMILEY_THEME_H_
-#define _PIDGIN_SMILEY_THEME_H_
- * SECTION:gtksmiley-theme
- * @include:gtksmiley-theme.h
- * @section_id: pidgin-smiley-theme
- * @short_description: a per-protocol categorized sets of standard smileys
- * @title: Pidgin's smiley themes
- * This class implements a per-protocol based #PurpleSmileyTheme.
-#include <glib-object.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#define PIDGIN_TYPE_SMILEY_THEME pidgin_smiley_theme_get_type()
- * pidgin_smiley_theme_get_type:
- * Returns: the #GType for a smiley list.
-G_DECLARE_FINAL_TYPE(PidginSmileyTheme, pidgin_smiley_theme, PIDGIN,
- SMILEY_THEME, PurpleSmileyTheme)
- * pidgin_smiley_theme_get_name:
- * @theme: the smiley theme.
- * Returns the name for a @theme. Valid themes always have the name set.
- * Returns: (transfer none): the name string, or %NULL if error occured.
-pidgin_smiley_theme_get_name(PidginSmileyTheme *theme);
- * pidgin_smiley_theme_get_description:
- * @theme: the smiley theme.
- * Returns the description for a @theme.
- * Returns: (transfer none): the description string, or %NULL if it's not
- * set or error occured.
-pidgin_smiley_theme_get_description(PidginSmileyTheme *theme);
- * pidgin_smiley_theme_get_icon:
- * @theme: the smiley theme.
- * Returns the @theme's icon image, possibly loading it from the disk (and
- * adding it to the cache).
- * Returns: (transfer none): the @theme's icon image.
-pidgin_smiley_theme_get_icon(PidginSmileyTheme *theme);
- * pidgin_smiley_theme_get_author:
- * @theme: the smiley theme.
- * Returns the autor of @theme.
- * Returns: (transfer none): the author string, or %NULL if it's not
- * set or error occured.
-pidgin_smiley_theme_get_author(PidginSmileyTheme *theme);
- * pidgin_smiley_theme_for_conv:
- * @conv: the conversation.
- * Gets the smiley list for a @conv based on current theme.
- * Returns: (transfer none): the smiley list, or %NULL if there
- * is no smiley theme set.
-pidgin_smiley_theme_for_conv(PurpleConversation *conv);
- * pidgin_smiley_theme_get_all:
- * Returns the list of currently available smiley themes.
- * Returns: (transfer none) (element-type PidginSmileyTheme): the #GList of #PidginSmileyTheme's.
-pidgin_smiley_theme_get_all(void);
- * _pidgin_smiley_theme_init: (skip)
- * Initializes the Pidgin's smiley theme subsystem.
-_pidgin_smiley_theme_init(void);
- * _pidgin_smiley_theme_uninit: (skip)
- * Unitializes the Pidgin's smiley theme subsystem.
-_pidgin_smiley_theme_uninit(void);
-#endif /* _PIDGIN_SMILEY_THEME_H_ */
--- a/pidgin/libpidgin.c Tue Aug 24 04:51:11 2021 -0500
+++ b/pidgin/libpidgin.c Tue Aug 24 04:52:14 2021 -0500
@@ -45,7 +45,6 @@
#include "gtksavedstatuses.h"
-#include "gtksmiley-theme.h"
#include "gtkwhiteboard.h"
#include "pidginapplication.h"
@@ -197,7 +196,6 @@
- _pidgin_smiley_theme_init();
@@ -209,7 +207,6 @@
- _pidgin_smiley_theme_uninit();
pidgin_commands_uninit();
pidgin_conversations_uninit();
--- a/pidgin/meson.build Tue Aug 24 04:51:11 2021 -0500
+++ b/pidgin/meson.build Tue Aug 24 04:52:14 2021 -0500
@@ -16,8 +16,6 @@
'gtkstatus-icon-theme.c',
@@ -85,8 +83,6 @@
'gtkstatus-icon-theme.h',
--- a/pidgin/pidginapplication.c Tue Aug 24 04:51:11 2021 -0500
+++ b/pidgin/pidginapplication.c Tue Aug 24 04:52:14 2021 -0500
@@ -40,7 +40,6 @@
-#include "gtksmiley-manager.h"
@@ -190,13 +189,6 @@
-pidgin_application_custom_smiley(GSimpleAction *simple, GVariant *parameter,
- pidgin_smiley_manager_show();
pidgin_application_debug(GSimpleAction *simple, GVariant *parameter,
@@ -316,9 +308,6 @@
.activate = pidgin_application_add_group,
- .name = "custom-smiley",
- .activate = pidgin_application_custom_smiley,
.activate = pidgin_application_debug,
--- a/pidgin/pidginstock.c Tue Aug 24 04:51:11 2021 -0500
+++ b/pidgin/pidginstock.c Tue Aug 24 04:52:14 2021 -0500
@@ -123,7 +123,6 @@
{ PIDGIN_STOCK_TOOLBAR_BGCOLOR, "actions", "change-bgcolor.png", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
{ PIDGIN_STOCK_TOOLBAR_BLOCK, "emblems", "emblem-blocked.png", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
{ PIDGIN_STOCK_TOOLBAR_FGCOLOR, "actions", "change-fgcolor.png", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
- { PIDGIN_STOCK_TOOLBAR_SMILEY, "actions", "emote-select.png", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
{ PIDGIN_STOCK_TOOLBAR_FONT_FACE, "actions", "font-face.png", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
{ PIDGIN_STOCK_TOOLBAR_TEXT_SMALLER, "actions", "font-size-down.png", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
{ PIDGIN_STOCK_TOOLBAR_TEXT_LARGER, "actions", "font-size-up.png", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
--- a/pidgin/pidginstock.h Tue Aug 24 04:51:11 2021 -0500
+++ b/pidgin/pidginstock.h Tue Aug 24 04:52:14 2021 -0500
@@ -98,7 +98,6 @@
#define PIDGIN_STOCK_TOOLBAR_BGCOLOR "pidgin-bgcolor"
#define PIDGIN_STOCK_TOOLBAR_BLOCK "pidgin-block"
#define PIDGIN_STOCK_TOOLBAR_FGCOLOR "pidgin-fgcolor"
-#define PIDGIN_STOCK_TOOLBAR_SMILEY "pidgin-smiley"
#define PIDGIN_STOCK_TOOLBAR_FONT_FACE "pidgin-font-face"
#define PIDGIN_STOCK_TOOLBAR_TEXT_SMALLER "pidgin-text-smaller"
#define PIDGIN_STOCK_TOOLBAR_TEXT_LARGER "pidgin-text-larger"
--- a/pidgin/prefs/pidginprefs.c Tue Aug 24 04:51:11 2021 -0500
+++ b/pidgin/prefs/pidginprefs.c Tue Aug 24 04:52:14 2021 -0500
@@ -38,7 +38,6 @@
#include "gtksavedstatuses.h"
-#include "gtksmiley-theme.h"
#include "gtkstatus-icon-theme.h"
@@ -123,8 +122,6 @@
- GtkWidget *resize_custom_smileys;
- GtkWidget *custom_smileys_size;
GtkWidget *minimum_entry_lines;
GtkTextBuffer *format_buffer;
@@ -194,7 +191,6 @@
@@ -227,11 +223,9 @@
static GtkWidget *prefs_status_themes_combo_box;
-static GtkWidget *prefs_smiley_themes_combo_box;
/* These exist outside the lifetime of the prefs dialog */
static GtkListStore *prefs_status_icon_themes;
-static GtkListStore *prefs_smiley_themes;
@@ -821,7 +815,6 @@
prefs_status_themes_combo_box = NULL;
- prefs_smiley_themes_combo_box = NULL;
g_free(prefs->proxy.gnome_program_path);
@@ -838,39 +831,6 @@
description != NULL ? description : "");
-smileys_refresh_theme_list(void)
- description = get_theme_markup(_("none"), FALSE, _("Penguin Pimps"),
- _("Selecting this disables graphical emoticons."));
- gtk_list_store_append(prefs_smiley_themes, &iter);
- gtk_list_store_set(prefs_smiley_themes, &iter,
- 0, NULL, 1, description, 2, "none", -1);
- for (it = pidgin_smiley_theme_get_all(); it; it = g_list_next(it)) {
- PidginSmileyTheme *theme = it->data;
- description = get_theme_markup(
- _(pidgin_smiley_theme_get_name(theme)), FALSE,
- _(pidgin_smiley_theme_get_author(theme)),
- _(pidgin_smiley_theme_get_description(theme)));
- gtk_list_store_append(prefs_smiley_themes, &iter);
- gtk_list_store_set(prefs_smiley_themes, &iter,
- 0, pidgin_smiley_theme_get_icon(theme),
- 2, pidgin_smiley_theme_get_name(theme),
/* adds the themes to the theme list from the manager so they can be displayed in prefs */
prefs_themes_sort(PurpleTheme *theme)
@@ -957,15 +917,10 @@
g_object_unref(G_OBJECT(pixbuf));
- gtk_list_store_clear(prefs_smiley_themes);
purple_theme_manager_for_each_theme(prefs_themes_sort);
- smileys_refresh_theme_list();
prefs_set_active_theme_combo(prefs_status_themes_combo_box, prefs_status_icon_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/status/icon-theme"));
- prefs_set_active_theme_combo(prefs_smiley_themes_combo_box, prefs_smiley_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/smileys/theme"));
/* init all the theme variables so that the themes can be sorted later and used by pref pages */
@@ -973,8 +928,6 @@
prefs_status_icon_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
- prefs_smiley_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
@@ -1053,7 +1006,7 @@
- gboolean is_smiley_theme, is_archive;
PurpleTheme *theme = NULL;
@@ -1072,10 +1025,7 @@
- if ((is_smiley_theme = purple_strequal(info->type, "smiley")))
- destdir = g_build_filename(purple_data_dir(), "smileys", NULL);
- destdir = g_build_filename(purple_data_dir(), "themes", "temp", NULL);
+ destdir = g_build_filename(purple_data_dir(), "themes", "temp", NULL); /* We'll check this just to make sure. This also lets us do something different on
* other platforms, if need be */
@@ -1112,11 +1062,7 @@
- /* just extract the folder to the smiley directory */
- prefs_themes_refresh();
- } else if (is_archive) {
theme = prefs_theme_find_theme(destdir, info->type);
if (PURPLE_IS_THEME(theme)) {
@@ -1329,59 +1275,6 @@
g_signal_connect(G_OBJECT(combo_box), "drag_data_received", G_CALLBACK(theme_dnd_recv), (gpointer) type);
-/* sets the current smiley theme */
-prefs_set_smiley_theme_cb(GtkComboBox *combo_box, gpointer user_data)
- if (gtk_combo_box_get_active_iter(combo_box, &new_iter)) {
- gtk_tree_model_get(GTK_TREE_MODEL(prefs_smiley_themes), &new_iter, 2, &new_theme, -1);
- purple_prefs_set_string(PIDGIN_PREFS_ROOT "/smileys/theme", new_theme);
-/* Does same as normal sort, except "none" is sorted first */
-static gint pidgin_sort_smileys (GtkTreeModel *model,
- gchar *name1 = NULL, *name2 = NULL;
- gtk_tree_model_get(model, a, 2, &name1, -1);
- gtk_tree_model_get(model, b, 2, &name2, -1);
- if (name1 == NULL || name2 == NULL) {
- if (!(name1 == NULL && name2 == NULL))
- ret = (name1 == NULL) ? -1: 1;
- } else if (!g_ascii_strcasecmp(name1, "none")) {
- if (!g_utf8_collate(name1, name2))
- } else if (!g_ascii_strcasecmp(name2, "none")) {
- /* Neither string is "none", default to normal sort */
- ret = purple_utf8_strcasecmp(name1, name2);
/* sets the current icon theme */
prefs_set_status_icon_theme_cb(GtkComboBox *combo_box, gpointer user_data)
@@ -1412,18 +1305,6 @@
PIDGIN_PREFS_ROOT "/status/icon-theme",
prefs_status_themes_combo_box = win->theme.status;
- prefs_build_theme_combo_box(win->theme.smiley, prefs_smiley_themes,
- PIDGIN_PREFS_ROOT "/smileys/theme",
- prefs_smiley_themes_combo_box = win->theme.smiley;
- /* Custom sort so "none" theme is at top of list */
- gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(prefs_smiley_themes),
- 2, pidgin_sort_smileys, NULL, NULL);
- gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(prefs_smiley_themes),
- 2, GTK_SORT_ASCENDING);
@@ -1534,21 +1415,6 @@
gtk_widget_hide(win->conversations.win32.blink_im);
- /* TODO: it's not implemented */
- pidgin_prefs_bind_checkbox(
- PIDGIN_PREFS_ROOT "/conversations/resize_custom_smileys",
- win->conversations.resize_custom_smileys);
- pidgin_prefs_bind_spin_button(
- PIDGIN_PREFS_ROOT "/conversations/custom_smileys_size",
- win->conversations.custom_smileys_size);
- g_object_bind_property(win->conversations.resize_custom_smileys, "active",
- win->conversations.custom_smileys_size, "sensitive",
- G_BINDING_SYNC_CREATE);
pidgin_prefs_bind_spin_button(
PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines",
win->conversations.minimum_entry_lines);
@@ -2508,12 +2374,6 @@
conversations.win32.blink_im);
gtk_widget_class_bind_template_child(
widget_class, PidginPrefsWindow,
- conversations.resize_custom_smileys);
- gtk_widget_class_bind_template_child(
- widget_class, PidginPrefsWindow,
- conversations.custom_smileys_size);
- gtk_widget_class_bind_template_child(
- widget_class, PidginPrefsWindow,
conversations.minimum_entry_lines);
gtk_widget_class_bind_template_child(
widget_class, PidginPrefsWindow,
@@ -2650,12 +2510,8 @@
gtk_widget_class_bind_template_child(
widget_class, PidginPrefsWindow, theme.status);
- gtk_widget_class_bind_template_child(
- widget_class, PidginPrefsWindow, theme.smiley);
gtk_widget_class_bind_template_callback(widget_class,
prefs_set_status_icon_theme_cb);
- gtk_widget_class_bind_template_callback(widget_class,
- prefs_set_smiley_theme_cb);
@@ -2687,31 +2543,6 @@
gtk_window_present(GTK_WINDOW(prefs));
-smiley_theme_pref_cb(const char *name, PurplePrefType type,
- gconstpointer value, gpointer data)
- const gchar *theme_name = value;
- if (purple_strequal(theme_name, "none")) {
- purple_smiley_theme_set_current(NULL);
- /* XXX: could be cached when initializing prefs view */
- themes = pidgin_smiley_theme_get_all();
- for (it = themes; it; it = g_list_next(it)) {
- PidginSmileyTheme *theme = it->data;
- if (!purple_strequal(pidgin_smiley_theme_get_name(theme), theme_name))
- purple_smiley_theme_set_current(PURPLE_SMILEY_THEME(theme));
@@ -2731,14 +2562,6 @@
- purple_prefs_add_none(PIDGIN_PREFS_ROOT "/smileys");
- purple_prefs_add_string(PIDGIN_PREFS_ROOT "/smileys/theme", "Default");
- purple_prefs_connect_callback(&prefs, PIDGIN_PREFS_ROOT "/smileys/theme",
- smiley_theme_pref_cb, NULL);
purple_prefs_add_none(PIDGIN_PREFS_ROOT "/vvconfig");
@@ -2794,9 +2617,7 @@
purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/html_shortcuts");
purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/icons_on_tabs");
purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/send_formatting");
- purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/show_smileys");
purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/show_urls_as_links");
- purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/smiley_shortcuts");
purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/use_custom_bgcolor");
purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/use_custom_fgcolor");
purple_prefs_remove(PIDGIN_PREFS_ROOT "/conversations/use_custom_font");
--- a/pidgin/resources/BuddyList/window.ui Tue Aug 24 04:51:11 2021 -0500
+++ b/pidgin/resources/BuddyList/window.ui Tue Aug 24 04:52:14 2021 -0500
@@ -235,16 +235,6 @@
<property name="visible">True</property>
<property name="can-focus">False</property>
- <object class="GtkMenuItem" id="custom_smileys">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="action-name">app.custom-smiley</property>
- <property name="label" translatable="yes">Custom Smile_ys</property>
- <property name="use-underline">True</property>
- <accelerator key="y" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<object class="GtkMenuItem" id="preferences">
<property name="visible">True</property>
<property name="can-focus">False</property>
--- a/pidgin/resources/Prefs/prefs.ui Tue Aug 24 04:51:11 2021 -0500
+++ b/pidgin/resources/Prefs/prefs.ui Tue Aug 24 04:52:14 2021 -0500
@@ -20,8 +20,8 @@
+ <requires lib="gtk+" version="3.22"/> <requires lib="Talkatu" version="0.0"/>
- <requires lib="gtk+" version="3.22"/>
<requires lib="pidgin" version="3.0"/>
<!-- interface-license-type gplv2 -->
<!-- interface-name Pidgin -->
@@ -78,13 +78,6 @@
<property name="step-increment">1</property>
<property name="page-increment">10</property>
- <object class="GtkAdjustment" id="conversations.custom_smiley_size.adjustment">
- <property name="lower">16</property>
- <property name="upper">512</property>
- <property name="value">16</property>
- <property name="step-increment">1</property>
- <property name="page-increment">10</property>
<object class="TalkatuTagTable" id="conversations.format_tag_table"/>
<object class="TalkatuWholeBuffer" id="conversations.format_buffer">
<property name="tag-table">conversations.format_tag_table</property>
@@ -674,7 +667,7 @@
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">5</property>
+ <property name="position">3</property> @@ -688,7 +681,7 @@
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">6</property>
+ <property name="position">4</property> @@ -703,58 +696,7 @@
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">7</property>
- <object class="GtkBox">
- <property name="can-focus">False</property>
- <property name="spacing">6</property>
- <object class="GtkCheckButton" id="conversations.resize_custom_smileys">
- <property name="label" translatable="yes">Resize incoming custom smileys</property>
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="receives-default">False</property>
- <property name="draw-indicator">True</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="label" translatable="yes">Maximum size:</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- <object class="GtkSpinButton" id="conversations.custom_smileys_size">
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="input-purpose">number</property>
- <property name="adjustment">conversations.custom_smiley_size.adjustment</property>
- <property name="numeric">True</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">8</property>
+ <property name="position">5</property> @@ -792,7 +734,7 @@
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">9</property>
+ <property name="position">6</property> @@ -927,38 +869,46 @@
<property name="orientation">vertical</property>
<object class="TalkatuEditor">
- <property name="orientation">vertical</property>
<property name="visible">True</property>
+ <property name="can-focus">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <child internal-child="toolbar">
- <object class="TalkatuToolbar">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="fill">False</property>
- <child internal-child="input">
- <object class="TalkatuView" id="conversations.format_view">
- <property name="width_request">450</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="wrap_mode">word</property>
- <property name="buffer">conversations.format_buffer</property>
- <property name="fill">False</property>
+ <property name="orientation">vertical</property> <child internal-child="send_button">
<object class="GtkButton">
<property name="can-focus">False</property>
<property name="receives-default">False</property>
+ <property name="expand">False</property> <property name="fill">False</property>
+ <property name="position">0</property> + <child internal-child="toolbar"> + <object class="TalkatuToolbar"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + <child internal-child="input"> + <object class="TalkatuInput" id="conversations.format_view"> + <property name="width-request">450</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="wrap-mode">word</property> + <property name="buffer">conversations.format_buffer</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> @@ -2285,7 +2235,7 @@
<property name="name">away</property>
<property name="title" translatable="yes">Status / Idle</property>
- <property name="position">6</property>
+ <property name="position">5</property> @@ -2380,60 +2330,6 @@
<property name="position">2</property>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="spacing">6</property>
- <object class="GtkLabel" id="label18">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="label" translatable="yes">Smiley Theme:</property>
- <property name="xalign">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- <object class="GtkComboBox" id="theme.smiley">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <signal name="changed" handler="prefs_set_smiley_theme_cb" swapped="no"/>
- <object class="GtkCellRendererPixbuf">
- <property name="width">32</property>
- <property name="height">32</property>
- <attribute name="pixbuf">0</attribute>
- <object class="GtkCellRendererText">
- <property name="ellipsize">end</property>
- <attribute name="markup">1</attribute>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
@@ -2460,24 +2356,18 @@
<property name="name">theme</property>
<property name="title" translatable="yes">Themes</property>
- <property name="position">7</property>
+ <property name="position">6</property> <object class="PidginCredentialsPage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="name">credentials</property>
<property name="title" translatable="yes">Credentials</property>
- <property name="position">8</property>
+ <property name="position">7</property> @@ -2527,13 +2417,11 @@
<object class="GtkSizeGroup" id="theme.combo_sg">
<widget name="theme.status"/>
- <widget name="theme.smiley"/>
<object class="GtkSizeGroup" id="theme.label_sg">
- <widget name="label18"/>
--- a/po/POTFILES.in Tue Aug 24 04:51:11 2021 -0500
+++ b/po/POTFILES.in Tue Aug 24 04:52:14 2021 -0500
@@ -276,11 +276,6 @@
libpurple/savedstatuses.c
-libpurple/smiley-custom.c
-libpurple/smiley-parser.c
-libpurple/smiley-theme.c
libpurple/tests/test_account_option.c
@@ -295,8 +290,6 @@
libpurple/tests/test_protocol_attention.c
libpurple/tests/test_protocol_xfer.c
libpurple/tests/test_queued_output_stream.c
-libpurple/tests/test_smiley.c
-libpurple/tests/test_smiley_list.c
libpurple/tests/test_trie.c
libpurple/tests/test_ui.c
libpurple/tests/test_util.c
@@ -328,8 +321,6 @@
pidgin/gtksavedstatuses.c
-pidgin/gtksmiley-manager.c
-pidgin/gtksmiley-theme.c
pidgin/gtkstatus-icon-theme.c