--- a/configure.ac Thu Jul 03 06:09:18 2008 -0400
+++ b/configure.ac Thu Jul 03 07:39:46 2008 -0400
@@ -192,7 +192,7 @@
AC_SUBST(FINCH_PIXMAPSDIR)
dnl #######################################################################
-dnl # check for gtk and other dependencies
dnl #######################################################################
PKG_CHECK_MODULES(GLIB, [glib-2.0], HAVE_GLIB="yes", HAVE_GLIB="no")
@@ -212,6 +212,9 @@
+dnl ####################################################################### +dnl ####################################################################### @@ -220,6 +223,34 @@
dnl #######################################################################
+dnl ####################################################################### +PKG_CHECK_MODULES(PANGO, [pango], HAVE_PANGO="yes", HAVE_PANGO="no") +if test x"$HAVE_PANGO" = x"yes" ; then + DEPENDENCIES="$DEPENDENCIES,pango" +dnl ####################################################################### +dnl ####################################################################### +PKG_CHECK_MODULES(CAIRO, [cairo], HAVE_CAIRO="yes", HAVE_CAIRO="no") +if test x"$HAVE_CAIRO" = x"yes" ; then + DEPENDENCIES="$DEPENDENCIES,cairo" +dnl ####################################################################### dnl # Check for talkfilters
dnl #######################################################################
AC_CHECK_HEADER(talkfilters.h, HAVE_TALKFILTERS=yes, AC_MSG_WARN([
--- a/splitter/splitter.c Thu Jul 03 06:09:18 2008 -0400
+++ b/splitter/splitter.c Thu Jul 03 07:39:46 2008 -0400
@@ -21,24 +21,22 @@
-#define GETTEXT_PACKAGE "gtk20"
-#include <glib/gi18n-lib.h>
+#include "../common/pp_internal.h" +#include <pango/pango.h>
+# include <pango/pangocairo.h>
-#define WEBSITE "http://ikebo.hypermart.net/"
#define PLUGIN_ID "core-ike-splitter"
@@ -64,21 +62,21 @@
PurpleConversationType type;
char *receiver; /* IM username */
/* plugin preference variables */
static gint current_split_size;
/* initialize preferences dialog */
-static PurplePluginPrefFrame *get_plugin_pref_frame(PurplePlugin *plugin)
+static PurplePluginPrefFrame * +get_plugin_pref_frame(PurplePlugin *plugin) { PurplePluginPrefFrame *frame;
@@ -113,13 +111,15 @@
* taken from conversation.c with signal emission removed.
-static void splitter_common_send(PurpleConversation *conv, const char *message, PurpleMessageFlags msgflags)
+splitter_common_send(PurpleConversation *conv, const char *message, + PurpleMessageFlags msgflags) PurpleConversationType type;
char *displayed = NULL, *sent = NULL;
if (strlen(message) == 0)
@@ -206,8 +206,8 @@
/* a timer based callback function that sends the next message in the queue */
-static gboolean send_message_timer_cb( message_to_conv *msg_to_conv )
+send_message_timer_cb( message_to_conv *msg_to_conv ) { PurpleConversation *conv;
@@ -258,9 +258,31 @@
+/* Create/get a pango context + * On windows we use the win32 context creator, on everything else we +splitter_create_pango_context(void) { + return pango_win32_get_context(); + PangoContext *context = NULL; + PangoFontMap *fontmap = pango_cairo_font_map_get_default(); + pango_cairo_font_map_create_context(PANGO_CAIRO_FONT_MAP(fontmap)); + g_object_unref(G_OBJECT(fontmap)); /* finds the first line-breakable character backwards starting from a[last] */
-static int find_last_break(PangoLogAttr *a, int last)
+find_last_break(PangoLogAttr *a, int last) { if( a[last].is_line_break == 1)
@@ -271,12 +293,12 @@
/* uses Pango to find all possible line break locations in a message and returns
a PangoLogAttr array which maps to each byte of the message of length
one larger than the message. This must be g_free()'d */
-static PangoLogAttr* find_all_breaks(const char *message)
+find_all_breaks(const char *message) {
g_return_val_if_fail(message != NULL, NULL);
@@ -285,7 +307,8 @@
a = g_new0(PangoLogAttr, n_attr);
- context = gdk_pango_context_get();
+ context = splitter_create_pango_context(); g_return_val_if_fail(context != NULL, NULL);
list = pango_itemize(context, message, 0, len, NULL, NULL);
@@ -298,9 +321,9 @@
/* return a queue of message slices from a plain text message based on current_split_size using
Pango to determine possible line break locations */
-static GQueue* get_message_slices(const char *message)
- int current_break_start, last_break_start, break_pos, len;
+get_message_slices(const char *message) { + gint current_break_start, last_break_start, break_pos, len; @@ -348,12 +371,12 @@
/* takes a message, splits it up based on whitespace (ignoring HTML formatting),
requests HTMLized slices of the splits, and returns a queue of them. The
messages and the queue must be freed */
-static GQueue* create_message_queue(const char *message)
+create_message_queue(const char *message) { GQueue *slices, *messages;
char *stripped_message, *msg;
stripped_message = purple_markup_strip_html(message);
stripped_len = strlen(stripped_message);
@@ -381,8 +404,8 @@
/* create message queue and prepare timer callbacks */
-static void split_and_send(message_to_conv *msg_to_conv, const char **message)
+split_and_send(message_to_conv *msg_to_conv, const char **message) { g_return_if_fail( msg_to_conv != NULL );
@@ -413,8 +436,8 @@
/* initialize a chat message to potentially be split */
-static void sending_chat_msg_cb(PurpleAccount *account, const char **message, int id)
+sending_chat_msg_cb(PurpleAccount *account, const char **message, int id) { message_to_conv *msg_to_conv;
purple_debug(PURPLE_DEBUG_MISC, "purple-splitter", "splitter plugin invoked\n");
@@ -435,8 +458,9 @@
/* initialize an IM message to potentially be split */
-static void sending_im_msg_cb(PurpleAccount *account, const char *receiver,
+sending_im_msg_cb(PurpleAccount *account, const char *receiver, message_to_conv *msg_to_conv;
@@ -459,8 +483,8 @@
/* register "sending" message signal callback */
-static gboolean plugin_load(PurplePlugin *plugin)
+plugin_load(PurplePlugin *plugin) { purple_signal_connect(purple_conversations_get_handle(),
@@ -476,8 +500,8 @@
-static gboolean plugin_unload(PurplePlugin *plugin)
+plugin_unload(PurplePlugin *plugin) { @@ -485,36 +509,32 @@
get_plugin_pref_frame, 0, NULL, NULL, NULL, NULL, NULL
-static PurplePluginInfo info =
+static PurplePluginInfo info = { - PURPLE_PLUGIN_STANDARD, /**< type */
- NULL, /**< ui_requirement */
- NULL, /**< dependencies */
- PURPLE_PRIORITY_DEFAULT, /**< priority */
+ PURPLE_PLUGIN_STANDARD, + PURPLE_PRIORITY_DEFAULT,
- N_("Message Splitter"), /**< name */
- VERSION, /**< version */
- N_("Splits a large outgoing message into smaller "
- "messages of a specified size."),
- N_("Splits a large outgoing message into smaller "
- "messages of a specified size."),
- "Ike Gingerich <ike_@users.sourceforge.net>", /**< author */
- WEBSITE, /**< homepage */
+ "Ike Gingerich <ike_@users.sourceforge.net>", - plugin_load, /**< load */
- plugin_unload, /**< unload */
- NULL, /**< extra_info */
- &prefs_info, /**< prefs_info */
@@ -523,8 +543,18 @@
/* store initial preference values */
-static void init_plugin(PurplePlugin *plugin)
+init_plugin(PurplePlugin *plugin) { + bindtextdomain(GETTEXT_PACKAGE, PP_LOCALEDIR); + bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); + info.name = _("Message Splitter"); + info.summary = _("Splits a large outgoing message into smaller messages of " + info.description = info.summary; purple_prefs_add_none("/plugins/core/splitter");
purple_prefs_add_int ("/plugins/core/splitter/split_size", DEFAULT_SPLIT_SIZE);
purple_prefs_add_int ("/plugins/core/splitter/delay_ms", DEFAULT_DELAY_MS);