/dev/tomkiewicz/new-smileys: 302a7cb4c1ab: Initial generic Purpl...
Tomasz Wasilczyk
twasilczyk at pidgin.im
Sat Mar 29 11:14:44 EDT 2014
Changeset: 302a7cb4c1ab461957c55bdb4ff0a7e37ead8b74
Author: Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date: 2014-03-29 16:14 +0100
Branch: default
URL: https://hg.pidgin.im/dev/tomkiewicz/new-smileys/rev/302a7cb4c1ab
Description:
Initial generic PurpleSmiley implementation
diffstat:
libpurple/core.c | 4 +
libpurple/plugins/perl/Makefile.am | 1 -
libpurple/plugins/perl/common/Smiley.xs | 80 --
libpurple/plugins/perl/common/typemap | 1 -
libpurple/protocols/jabber/message.c | 6 +
libpurple/protocols/msn/msn.c | 6 +
libpurple/protocols/msn/slpcall.c | 3 +-
libpurple/smiley.c | 904 +++----------------------------
libpurple/smiley.h | 219 +------
pidgin/gtksmiley.c | 18 +
pidgin/gtkwebviewtoolbar.c | 4 +
pidgin/smileyparser.c | 6 +
12 files changed, 161 insertions(+), 1091 deletions(-)
diffs (truncated from 1667 to 300 lines):
diff --git a/libpurple/core.c b/libpurple/core.c
--- a/libpurple/core.c
+++ b/libpurple/core.c
@@ -202,7 +202,9 @@ purple_core_init(const char *ui)
purple_xfers_init();
purple_idle_init();
purple_http_init();
+#if 0
purple_smileys_init();
+#endif
/*
* Call this early on to try to auto-detect our IP address and
* hopefully save some time later.
@@ -254,7 +256,9 @@ purple_core_quit(void)
purple_plugins_unload(PURPLE_PLUGIN_STANDARD);
/* Save .xml files, remove signals, etc. */
+#if 0
purple_smileys_uninit();
+#endif
purple_http_uninit();
purple_idle_uninit();
purple_pounces_uninit();
diff --git a/libpurple/plugins/perl/Makefile.am b/libpurple/plugins/perl/Makefile.am
--- a/libpurple/plugins/perl/Makefile.am
+++ b/libpurple/plugins/perl/Makefile.am
@@ -68,7 +68,6 @@ common_sources = \
common/SavedStatuses.xs \
common/Server.xs \
common/Signal.xs \
- common/Smiley.xs \
common/Sound.xs \
common/Status.xs \
common/Stringref.xs \
diff --git a/libpurple/plugins/perl/common/Smiley.xs b/libpurple/plugins/perl/common/Smiley.xs
deleted file mode 100644
--- a/libpurple/plugins/perl/common/Smiley.xs
+++ /dev/null
@@ -1,80 +0,0 @@
-#include "module.h"
-
-MODULE = Purple::Smiley PACKAGE = Purple::Smiley PREFIX = purple_smiley_
-PROTOTYPES: ENABLE
-
-Purple::Smiley
-purple_smiley_new(img, shortcut)
- Purple::StoredImage img
- const char * shortcut
-
-Purple::Smiley
-purple_smiley_new_from_file(shortcut, filepath)
- const char * shortcut
- const char * filepath
-
-void
-purple_smiley_delete(smiley)
- Purple::Smiley smiley
-
-gboolean
-purple_smiley_set_shortcut(smiley, shortcut)
- Purple::Smiley smiley
- const char * shortcut
-
-void
-purple_smiley_set_data(smiley, data, data_len)
- Purple::Smiley smiley
- guchar * data
- size_t data_len
-
-const char *
-purple_smiley_get_shortcut(smiley)
- Purple::Smiley smiley
-
-const char *
-purple_smiley_get_checksum(smiley)
- Purple::Smiley smiley
-
-Purple::StoredImage
-purple_smiley_get_stored_image(smiley)
- Purple::Smiley smiley
-
-gconstpointer
-purple_smiley_get_data(smiley, len)
- Purple::Smiley smiley
- size_t * len
-
-const char *
-purple_smiley_get_extension(smiley)
- Purple::Smiley smiley
-
-
-gchar_own *
-purple_smiley_get_full_path(smiley)
- Purple::Smiley smiley
-
-
-MODULE = Purple::Smiley PACKAGE = Purple::Smileys PREFIX = purple_smileys_
-PROTOTYPES: ENABLE
-
-void
-purple_smileys_get_all()
-PREINIT:
- GList *l;
-PPCODE:
- for (l = purple_smileys_get_all(); l != NULL; l = g_list_delete_link(l, l)) {
- XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Smiley")));
- }
-
-Purple::Smiley
-purple_smileys_find_by_shortcut(shortcut)
- const char * shortcut
-
-Purple::Smiley
-purple_smileys_find_by_checksum(checksum)
- const char * checksum
-
-const char *
-purple_smileys_get_storing_dir()
-
diff --git a/libpurple/plugins/perl/common/typemap b/libpurple/plugins/perl/common/typemap
--- a/libpurple/plugins/perl/common/typemap
+++ b/libpurple/plugins/perl/common/typemap
@@ -135,7 +135,6 @@ Purple::Ssl::Ops T_PurpleObj
Purple::Presence T_PurpleObj
Purple::AccountPresence T_PurpleObj
Purple::BuddyPresence T_PurpleObj
-Purple::Smiley T_PurpleObj
Purple::Status T_PurpleObj
Purple::StatusAttr T_PurpleObj
Purple::StatusPrimitive T_IV
diff --git a/libpurple/protocols/jabber/message.c b/libpurple/protocols/jabber/message.c
--- a/libpurple/protocols/jabber/message.c
+++ b/libpurple/protocols/jabber/message.c
@@ -824,6 +824,7 @@ jabber_message_get_mimetype_from_ext(con
static GList *
jabber_message_xhtml_find_smileys(const char *xhtml)
{
+#if 0
GList *smileys = purple_smileys_get_all();
GList *found_smileys = NULL;
@@ -844,6 +845,9 @@ jabber_message_xhtml_find_smileys(const
}
return found_smileys;
+#else
+ return NULL;
+#endif
}
static gchar *
@@ -943,6 +947,7 @@ jabber_message_smileyfy_xhtml(JabberMess
GList *valid_smileys = NULL;
gboolean has_too_large_smiley = FALSE;
+#if 0
for (iterator = found_smileys; iterator ;
iterator = g_list_next(iterator)) {
PurpleSmiley *smiley = (PurpleSmiley *) iterator->data;
@@ -975,6 +980,7 @@ jabber_message_smileyfy_xhtml(JabberMess
JABBER_DATA_MAX_SIZE);
}
}
+#endif
if (has_too_large_smiley) {
purple_conversation_write(conv, NULL,
diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c
--- a/libpurple/protocols/msn/msn.c
+++ b/libpurple/protocols/msn/msn.c
@@ -1468,6 +1468,7 @@ static void msn_emoticon_destroy(MsnEmot
static GSList* msn_msg_grab_emoticons(const char *msg, const char *username)
{
+#if 0
GSList *list;
GList *smileys;
PurpleSmiley *smiley;
@@ -1502,6 +1503,9 @@ static GSList* msn_msg_grab_emoticons(co
}
return list;
+#else
+ return NULL;
+#endif
}
void
@@ -2056,6 +2060,7 @@ msn_chat_send(PurpleConnection *gc, int
msg = msn_message_new_plain(msgtext);
msn_message_set_header(msg, "X-MMS-IM-Format", msgformat);
+#if 0
smileys = msn_msg_grab_emoticons(msg->body, username);
while (smileys) {
smile = (MsnEmoticon *)smileys->data;
@@ -2072,6 +2077,7 @@ msn_chat_send(PurpleConnection *gc, int
msn_emoticon_destroy(smile);
smileys = g_slist_delete_link(smileys, smileys);
}
+#endif
if (emoticons) {
msn_send_emoticons(swboard, emoticons);
diff --git a/libpurple/protocols/msn/slpcall.c b/libpurple/protocols/msn/slpcall.c
--- a/libpurple/protocols/msn/slpcall.c
+++ b/libpurple/protocols/msn/slpcall.c
@@ -239,7 +239,7 @@ find_valid_emoticon(PurpleAccount *accou
if (!purple_account_get_bool(account, "custom_smileys", TRUE))
return NULL;
-
+#if 0
smileys = purple_smileys_get_all();
for (; smileys; smileys = g_list_delete_link(smileys, smileys)) {
@@ -256,6 +256,7 @@ find_valid_emoticon(PurpleAccount *accou
purple_imgstore_unref(img);
}
+#endif
purple_debug_error("msn", "Received illegal request for file %s\n", path);
return NULL;
diff --git a/libpurple/smiley.c b/libpurple/smiley.c
--- a/libpurple/smiley.c
+++ b/libpurple/smiley.c
@@ -31,260 +31,24 @@
#define PURPLE_SMILEY_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_SMILEY, PurpleSmileyPrivate))
-/**************************************************************************/
-/* Structs */
-/**************************************************************************/
-
typedef struct {
- PurpleStoredImage *img; /* The id of the stored image with the
- the smiley data. */
- char *shortcut; /* Shortcut associated with the custom
- smiley. This field will work as a
- unique key by this API. */
- char *checksum; /* The smiley checksum. */
+ gchar *shortcut;
+ gchar *path;
+ gboolean is_ready;
} PurpleSmileyPrivate;
-static GHashTable *smiley_shortcut_index = NULL; /* shortcut (char *) => smiley (PurpleSmiley*) */
-static GHashTable *smiley_checksum_index = NULL; /* checksum (char *) => smiley (PurpleSmiley*) */
-
-static guint save_timer = 0;
-static gboolean smileys_loaded = FALSE;
-static char *smileys_dir = NULL;
-
-#define SMILEYS_DEFAULT_FOLDER "custom_smiley"
-#define SMILEYS_LOG_ID "smileys"
-
-#define XML_FILE_NAME "smileys.xml"
-
-#define XML_ROOT_TAG "smileys"
-#define XML_PROFILE_TAG "profile"
-#define XML_PROFILE_NAME_ATTRIB_TAG "name"
-#define XML_ACCOUNT_TAG "account"
-#define XML_ACCOUNT_USERID_ATTRIB_TAG "userid"
-#define XML_SMILEY_SET_TAG "smiley_set"
-#define XML_SMILEY_TAG "smiley"
-#define XML_SHORTCUT_ATTRIB_TAG "shortcut"
-#define XML_CHECKSUM_ATRIB_TAG "checksum"
-#define XML_FILENAME_ATRIB_TAG "filename"
-
-
-/******************************************************************************
- * XML descriptor file layout *
- ******************************************************************************
- *
- * Although we are creating the profile XML structure here, now we
- * won't handle it.
- * So, we just add one profile named "default" that has no associated
- * account elements, and have only the smiley_set that will contain
- * all existent custom smiley.
- *
- * It's our "Highlander Profile" :-)
- *
- ******************************************************************************
- *
- * <smileys>
- * <profile name="john.doe">
- * <account userid="john.doe at jabber.org">
- * <account userid="john.doe at gmail.com">
- * <smiley_set>
- * <smiley shortcut="aaa" checksum="xxxxxxxx" filename="file_name1.gif"/>
- * <smiley shortcut="bbb" checksum="yyyyyyy" filename="file_name2.gif"/>
- * </smiley_set>
- * </profile>
- * </smiley>
- *
- *****************************************************************************/
-
-
-/*********************************************************************
More information about the Commits
mailing list