Mercurial > pidgin
changeset 26618:c0ab14a1e43a
merge of '580055bb22fea0076d3a90d9df9346abd1789bab'
and 'fade006b4836b4f79bfcbf8d5be330408eda6273'
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Fri, 17 Apr 2009 21:29:18 +0000 |
parents | 8c3b1a059ecc (diff) cb6dd7ee9df3 (current diff) |
children | 4a18d518a572 |
files | |
diffstat | 105 files changed, 1854 insertions(+), 653 deletions(-) [+] |
line wrap: on
line diff
--- a/COPYRIGHT Fri Apr 17 21:29:11 2009 +0000 +++ b/COPYRIGHT Fri Apr 17 21:29:18 2009 +0000 @@ -30,6 +30,7 @@ Derek Battams Martin Bayard Curtis Beattie +Carlos Bederian Dave Bell Igor Belyi Brian Bernas @@ -333,10 +334,9 @@ Joao Luís Marques Pinto Aleksander Piotrowski Julien Pivotto +Robey Pointer Eric Polino <aluink@gmail.com> Ari Pollak -Robey Pointer -Eric Polino Stephen Pope Nathan Poznick Jory A. Pratt
--- a/ChangeLog Fri Apr 17 21:29:11 2009 +0000 +++ b/ChangeLog Fri Apr 17 21:29:18 2009 +0000 @@ -8,6 +8,11 @@ in a group on the buddy list. * Removed the unmaintained and unneeded toc protocol plugin. * Fixed NTLM authentication on big-endian systems. + * Dragging a buddy onto a chat pops up a chat-invitation dialog. + (Carlos Bederian) + + libpurple: + * Various memory cleanups when unloading libpurple. (Nick Hebner) XMPP: * Add voice & video support with Jingle (XEP-0166, 0167, 0176, & 0177), @@ -40,6 +45,7 @@ Finch: * The hardware cursor is updated correctly. This will be useful especially for users of braille terminals, screen readers etc. + * Added a TinyURL plugin, which aids copying longer URLs. version 2.5.5 (03/01/2009): libpurple:
--- a/ChangeLog.API Fri Apr 17 21:29:11 2009 +0000 +++ b/ChangeLog.API Fri Apr 17 21:29:18 2009 +0000 @@ -9,6 +9,7 @@ * PURPLE_CONTACT * PURPLE_BUDDY * PURPLE_CHAT + * purple_buddy_destroy * purple_buddy_get_protocol_data * purple_buddy_set_protocol_data * purple_buddy_get_local_buddy_alias @@ -17,9 +18,13 @@ * purple_blist_set_ui_data * purple_blist_node_get_ui_data * purple_blist_node_set_ui_data + * purple_chat_destroy * purple_connection_get_protocol_data * purple_connection_set_protocol_data + * purple_contact_destroy + * purple_conv_chat_invite_user * purple_global_proxy_set_info + * purple_group_destroy * purple_log_get_activity_score * purple_network_force_online * purple_network_set_stun_server @@ -73,6 +78,10 @@ * pidgin_utils_init, pidgin_utils_uninit * pidgin_notify_pounce_add + libgnt: + Added: + * GntProgressBar and functions (Saleem Abdulrasool) + perl: Changed: * Made a bunch of functions act more perl-like. Call the new()
--- a/configure.ac Fri Apr 17 21:29:11 2009 +0000 +++ b/configure.ac Fri Apr 17 21:29:18 2009 +0000 @@ -706,9 +706,13 @@ PKG_CHECK_MODULES(LIBXML, [libxml-2.0 >= 2.6.0], , [ AC_MSG_RESULT(no) AC_MSG_ERROR([ - You must have libxml2 >= 2.6.0 development headers installed to build. ])]) +PKG_CHECK_EXISTS([libxml-2.0 >= 2.6.18], , [ + AC_MSG_WARN([ +Versions of libxml2 < 2.6.18 may contain bugs that could cause XMPP messages to be discarded. +])]) + AC_SUBST(LIBXML_CFLAGS) AC_SUBST(LIBXML_LIBS) @@ -748,13 +752,33 @@ fi dnl ####################################################################### +dnl # Check for GStreamer Interfaces +dnl ####################################################################### +if test "x$enable_gst" != "xno"; then + AC_ARG_ENABLE(gstreamer-interfaces, + [AC_HELP_STRING([--disable-gstreamer-interfaces], [compile without GStreamer interface support])], + enable_gstinterfaces="$enableval", enable_gstinterfaces="yes") + if test "x$enable_gstinterfaces" != "xno"; then + PKG_CHECK_MODULES(GSTINTERFACES, [gstreamer-interfaces-0.10], [ + AC_DEFINE(USE_GSTINTERFACES, 1, [Use GStreamer interfaces for X overlay support]) + AC_SUBST(GSTINTERFACES_CFLAGS) + AC_SUBST(GSTINTERFACES_LIBS) + ], [ + enable_gstinterfaces="no" + ]) + fi +else + enable_gstinterfaces="no" +fi + +dnl ####################################################################### dnl # Check for Farsight dnl ####################################################################### AC_ARG_ENABLE(farsight, [AC_HELP_STRING([--disable-farsight], [compile without farsight support])], enable_farsight="$enableval", enable_farsight="yes") if test "x$enable_farsight" != "xno"; then - PKG_CHECK_MODULES(FARSIGHT, [farsight2-0.10 >= 0.0.8 gstreamer-0.10 gstreamer-plugins-base-0.10 libxml-2.0], [ + PKG_CHECK_MODULES(FARSIGHT, [farsight2-0.10 >= 0.0.9], [ AC_DEFINE(USE_FARSIGHT, 1, [Use Farsight for voice and video]) AC_SUBST(FARSIGHT_CFLAGS) AC_SUBST(FARSIGHT_LIBS) @@ -764,41 +788,21 @@ fi dnl ####################################################################### -dnl # Check for GStreamer-properties -dnl ####################################################################### -AC_ARG_ENABLE(gstprops, - [AC_HELP_STRING([--disable-gstprops], [compile without gstreamer props])], - enable_gstprops="$enableval", enable_gstprops="yes") -if test "x$enable_gstprops" != "xno"; -then - dnl gstreamer-libs-$GST_MAJORMINOR - dnl gstreamer-gconf-$GST_MAJORMINOR - PKG_CHECK_MODULES(GSTPROPS, [gstreamer-0.10 gstreamer-plugins-base-0.10 libxml-2.0], [ - GSTPROPS_LIBS="$GSTPROPS_LIBS -lgstinterfaces-0.10" - AC_DEFINE(USE_GSTPROPS, 1, [Use GStreamer property probe for finding devices]) - AC_SUBST(GSTPROPS_LIBS) - AC_SUBST(GSTPROPS_CFLAGS) - ], [ - enable_gstprops="no" - ]) -fi - -dnl ####################################################################### dnl # Check for Voice and Video support dnl ####################################################################### AC_ARG_ENABLE(vv, [AC_HELP_STRING([--disable-vv], [compile without voice and video support])], - [enable_vv="$enableval" force_vv=$enableval], [enable_vv="yes" enable_vv=no]) + [enable_vv="$enableval" force_vv=$enableval], [enable_vv="yes" force_vv=no]) if test "x$enable_vv" != "xno"; then - if test "x$enable_farsight" != "xno" -a "x$enable_gstprops" != "xno"; then + if test "x$enable_gstreamer" != "xno" -a "x$enable_gstinterfaces" != "xno" -a "x$enable_farsight" != "xno"; then AC_DEFINE(USE_VV, 1, [Use voice and video]) else enable_vv="no" if test "x$force_vv" = "xyes"; then AC_MSG_ERROR([ - -Dependencies for voice/video were not met. Install the necessary gstreamer and farsight packages first. - +Dependencies for voice/video were not met. +Install the necessary gstreamer and farsight packages first. +Or use --disable-vv if you do not need voice/video support. ]) fi fi @@ -982,7 +986,7 @@ gadu_includes="yes" gadu_libs="yes" ], [ - AC_MSG_RESULT(no) + gadu_includes="no" ]) else if test "$ac_gadu_includes" != "no"; then
--- a/finch/gntaccount.c Fri Apr 17 21:29:11 2009 +0000 +++ b/finch/gntaccount.c Fri Apr 17 21:29:18 2009 +0000 @@ -669,8 +669,13 @@ account_toggled(GntWidget *widget, void *key, gpointer null) { PurpleAccount *account = key; + gboolean enabled = gnt_tree_get_choice(GNT_TREE(widget), key); - purple_account_set_enabled(account, FINCH_UI, gnt_tree_get_choice(GNT_TREE(widget), key)); + if (enabled) + purple_savedstatus_activate_for_account(purple_savedstatus_get_current(), + account); + + purple_account_set_enabled(account, FINCH_UI, enabled); } static gboolean
--- a/finch/gntconv.c Fri Apr 17 21:29:11 2009 +0000 +++ b/finch/gntconv.c Fri Apr 17 21:29:18 2009 +0000 @@ -559,44 +559,11 @@ } static void -invite_select_cb(FinchConv *fc, PurpleRequestFields *fields) -{ - PurpleConversation *conv = fc->active_conv; - const char *buddy = purple_request_fields_get_string(fields, "screenname"); - const char *message = purple_request_fields_get_string(fields, "message"); - serv_chat_invite(purple_conversation_get_gc(conv), - purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), - message, buddy); - -} - -static void invite_cb(GntMenuItem *item, gpointer ggconv) { - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - - fields = purple_request_fields_new(); - - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_string_new("screenname", _("Name"), NULL, FALSE); - purple_request_field_set_type_hint(field, "screenname"); - purple_request_field_set_required(field, TRUE); - purple_request_field_group_add_field(group, field); - field = purple_request_field_string_new("message", _("Invite message"), NULL, FALSE); - purple_request_field_group_add_field(group, field); - purple_request_fields(finch_conv_get_handle(), _("Invite"), - NULL, - _("Please enter the name of the user " - "you wish to invite,\nalong with an optional invite message."), - fields, - _("OK"), G_CALLBACK(invite_select_cb), - _("Cancel"), NULL, - NULL, NULL, NULL, - ggconv); + FinchConv *fc = ggconv; + PurpleConversation *conv = fc->active_conv; + purple_conv_chat_invite_user(PURPLE_CONV_CHAT(conv), NULL, NULL, TRUE); } static void
--- a/finch/gntmedia.c Fri Apr 17 21:29:11 2009 +0000 +++ b/finch/gntmedia.c Fri Apr 17 21:29:18 2009 +0000 @@ -37,11 +37,11 @@ #include "cmds.h" #include "conversation.h" #include "debug.h" -#include "media-gst.h" #include "mediamanager.h" /* An incredibly large part of the following is from gtkmedia.c */ #ifdef USE_VV +#include "media-gst.h" #undef hangup @@ -254,16 +254,15 @@ } else if (state == PURPLE_MEDIA_STATE_NEW && sid != NULL && name != NULL && purple_media_is_initiator(media, sid, name) == FALSE) { - PurpleConnection *pc; + PurpleAccount *account; PurpleBuddy *buddy; const gchar *alias; PurpleMediaSessionType type = purple_media_get_session_type(media, sid); gchar *message = NULL; - pc = purple_media_get_connection(gntmedia->priv->media); - buddy = purple_find_buddy( - purple_connection_get_account(pc), name); + account = purple_media_get_account(gntmedia->priv->media); + buddy = purple_find_buddy(account, name); alias = buddy ? purple_buddy_get_contact_alias(buddy) : name; if (type & PURPLE_MEDIA_AUDIO) { @@ -386,13 +385,12 @@ static gboolean finch_new_media(PurpleMediaManager *manager, PurpleMedia *media, - PurpleConnection *gc, gchar *name, gpointer null) + PurpleAccount *account, gchar *name, gpointer null) { GntWidget *gntmedia; PurpleConversation *conv; - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, - purple_connection_get_account(gc), name); + conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); gntmedia = finch_media_new(media); g_signal_connect(G_OBJECT(gntmedia), "message", G_CALLBACK(gntmedia_message_cb), conv);
--- a/finch/libgnt/Makefile.am Fri Apr 17 21:29:11 2009 +0000 +++ b/finch/libgnt/Makefile.am Fri Apr 17 21:29:18 2009 +0000 @@ -28,6 +28,7 @@ gntmenu.c \ gntmenuitem.c \ gntmenuitemcheck.c \ + gntprogressbar.c \ gntslider.c \ gntstyle.c \ gnttextview.c \ @@ -56,6 +57,7 @@ gntmenu.h \ gntmenuitem.h \ gntmenuitemcheck.h \ + gntprogressbar.h \ gntslider.h \ gntstyle.h \ gnttextview.h \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/finch/libgnt/gntprogressbar.c Fri Apr 17 21:29:18 2009 +0000 @@ -0,0 +1,253 @@ +/** + * GNT - The GLib Ncurses Toolkit + * + * GNT 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 library 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 "gntprogressbar.h" +#include "gntutils.h" + +#include <string.h> + +typedef struct _GntProgressBarPrivate +{ + gdouble fraction; + gboolean show_value; + GntProgressBarOrientation orientation; +} GntProgressBarPrivate; + +struct _GntProgressBar +{ + GntWidget parent; +#if !GLIB_CHECK_VERSION(2,4,0) + GntProgressBarPrivate priv; +#endif +}; + +#if GLIB_CHECK_VERSION(2,4,0) +#define GNT_PROGRESS_BAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNT_TYPE_PROGRESS_BAR, GntProgressBarPrivate)) +#else +#define GNT_PROGRESS_BAR_GET_PRIVATE(o) &(GNT_PROGRESS_BAR(o)->priv) +#endif + +static GntWidgetClass *parent_class = NULL; + + +static void +gnt_progress_bar_draw (GntWidget *widget) +{ + GntProgressBarPrivate *priv = GNT_PROGRESS_BAR_GET_PRIVATE (GNT_PROGRESS_BAR (widget)); + gchar progress[8]; + gint start, end, i, pos; + int color; + + g_snprintf (progress, sizeof (progress), "%.1f%%", priv->fraction * 100); + color = gnt_color_pair(GNT_COLOR_NORMAL); + + switch (priv->orientation) { + case GNT_PROGRESS_LEFT_TO_RIGHT: + case GNT_PROGRESS_RIGHT_TO_LEFT: + start = (priv->orientation == GNT_PROGRESS_LEFT_TO_RIGHT ? 0 : (1.0 - priv->fraction) * widget->priv.width); + end = (priv->orientation == GNT_PROGRESS_LEFT_TO_RIGHT ? widget->priv.width * priv->fraction : widget->priv.width); + + /* background */ + for (i = 0; i < widget->priv.height; i++) + mvwhline (widget->window, i, 0, ' ' | color, widget->priv.width); + + /* foreground */ + for (i = 0; i < widget->priv.height; i++) + mvwhline (widget->window, i, start, ACS_CKBOARD | color | A_REVERSE, end); + + /* text */ + if (priv->show_value) { + pos = widget->priv.width / 2 - strlen (progress) / 2; + for (i = 0; i < progress[i]; i++, pos++) { + wattrset (widget->window, color | ((pos < start || pos > end) ? A_NORMAL : A_REVERSE)); + mvwprintw (widget->window, widget->priv.height / 2, pos, "%c", progress[i]); + } + wattrset (widget->window, color); + } + + break; + case GNT_PROGRESS_TOP_TO_BOTTOM: + case GNT_PROGRESS_BOTTOM_TO_TOP: + start = (priv->orientation == GNT_PROGRESS_TOP_TO_BOTTOM ? 0 : (1.0 - priv->fraction) * widget->priv.height); + end = (priv->orientation == GNT_PROGRESS_TOP_TO_BOTTOM ? widget->priv.height * priv->fraction : widget->priv.height); + + /* background */ + for (i = 0; i < widget->priv.width; i++) + mvwvline (widget->window, 0, i, ' ' | color, widget->priv.height); + + /* foreground */ + for (i = 0; i < widget->priv.width; i++) + mvwvline (widget->window, start, i, ACS_CKBOARD | color | A_REVERSE, end); + + /* text */ + if (priv->show_value) { + pos = widget->priv.height / 2 - strlen (progress) / 2; + for (i = 0; i < progress[i]; i++, pos++) { + wattrset (widget->window, color | ((pos < start || pos > end) ? A_NORMAL : A_REVERSE)); + mvwprintw (widget->window, pos, widget->priv.width / 2, "%c\n", progress[i]); + } + wattrset (widget->window, color); + } + + break; + default: + g_assert_not_reached (); + } +} + +static void +gnt_progress_bar_size_request (GntWidget *widget) +{ + gnt_widget_set_size (widget, widget->priv.minw, widget->priv.minh); +} + +static void +gnt_progress_bar_class_init (gpointer klass, gpointer class_data) +{ + GObjectClass *g_class = G_OBJECT_CLASS (klass); + + parent_class = GNT_WIDGET_CLASS (klass); + +#if GLIB_CHECK_VERSION(2,4,0) + g_type_class_add_private (g_class, sizeof (GntProgressBarPrivate)); +#endif + + parent_class->draw = gnt_progress_bar_draw; + parent_class->size_request = gnt_progress_bar_size_request; +} + +static void +gnt_progress_bar_init (GTypeInstance *instance, gpointer g_class) +{ + GntWidget *widget = GNT_WIDGET (instance); + GntProgressBarPrivate *priv = GNT_PROGRESS_BAR_GET_PRIVATE (GNT_PROGRESS_BAR (widget)); + + gnt_widget_set_take_focus (widget, FALSE); + GNT_WIDGET_SET_FLAGS (widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW | GNT_WIDGET_GROW_X); + + widget->priv.minw = 8; + widget->priv.minh = 1; + + priv->show_value = TRUE; +} + +GType +gnt_progress_bar_get_type (void) +{ + static GType type = 0; + + if (type == 0) { + static const GTypeInfo info = { + sizeof (GntProgressBarClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + gnt_progress_bar_class_init, /* class_init */ + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GntProgressBar), + 0, /* n_preallocs */ + gnt_progress_bar_init, /* instance_init */ + NULL /* value_table */ + }; + + type = g_type_register_static (GNT_TYPE_WIDGET, "GntProgressBar", &info, 0); + } + + return type; +} + +GntWidget * +gnt_progress_bar_new (void) +{ + GntWidget *widget = g_object_new (GNT_TYPE_PROGRESS_BAR, NULL); + return widget; +} + +void +gnt_progress_bar_set_fraction (GntProgressBar *pbar, gdouble fraction) +{ + GntProgressBarPrivate *priv = GNT_PROGRESS_BAR_GET_PRIVATE (pbar); + + if (fraction > 1.0) + priv->fraction = 1.0; + else if (fraction < 0.0) + priv->fraction = 0.0; + else + priv->fraction = fraction; + + if ((GNT_WIDGET_FLAGS(pbar) & GNT_WIDGET_MAPPED)) + gnt_widget_draw(GNT_WIDGET(pbar)); +} + +void +gnt_progress_bar_set_orientation (GntProgressBar *pbar, + GntProgressBarOrientation orientation) +{ + GntProgressBarPrivate *priv = GNT_PROGRESS_BAR_GET_PRIVATE (pbar); + GntWidget *widget = GNT_WIDGET(pbar); + + priv->orientation = orientation; + if (orientation == GNT_PROGRESS_LEFT_TO_RIGHT || + orientation == GNT_PROGRESS_RIGHT_TO_LEFT) { + GNT_WIDGET_SET_FLAGS(pbar, GNT_WIDGET_GROW_X); + GNT_WIDGET_UNSET_FLAGS(pbar, GNT_WIDGET_GROW_Y); + widget->priv.minw = 8; + widget->priv.minh = 1; + } else { + GNT_WIDGET_UNSET_FLAGS(pbar, GNT_WIDGET_GROW_X); + GNT_WIDGET_SET_FLAGS(pbar, GNT_WIDGET_GROW_Y); + widget->priv.minw = 1; + widget->priv.minh = 8; + } + + if ((GNT_WIDGET_FLAGS(pbar) & GNT_WIDGET_MAPPED)) + gnt_widget_draw(GNT_WIDGET(pbar)); +} + +void +gnt_progress_bar_set_show_progress (GntProgressBar *pbar, gboolean show) +{ + GntProgressBarPrivate *priv = GNT_PROGRESS_BAR_GET_PRIVATE (pbar); + priv->show_value = show; +} + +gdouble +gnt_progress_bar_get_fraction (GntProgressBar *pbar) +{ + GntProgressBarPrivate *priv = GNT_PROGRESS_BAR_GET_PRIVATE (pbar); + return priv->fraction; +} + +GntProgressBarOrientation +gnt_progress_bar_get_orientation (GntProgressBar *pbar) +{ + GntProgressBarPrivate *priv = GNT_PROGRESS_BAR_GET_PRIVATE (pbar); + return priv->orientation; +} + +gboolean +gnt_progress_bar_get_show_progress (GntProgressBar *pbar) +{ + GntProgressBarPrivate *priv = GNT_PROGRESS_BAR_GET_PRIVATE (pbar); + return priv->show_value; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/finch/libgnt/gntprogressbar.h Fri Apr 17 21:29:18 2009 +0000 @@ -0,0 +1,132 @@ +/** + * @file gntprogressbar.h Progress Bar API + * @ingroup gnt + */ +/* + * GNT - The GLib Ncurses Toolkit + * + * GNT 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 library 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 + */ + +#ifndef GNT_PROGRESS_BAR_H +#define GNT_PROGRESS_BAR_H + +#include "gnt.h" +#include "gntwidget.h" + +#define GNT_TYPE_PROGRESS_BAR (gnt_progress_bar_get_type ()) +#define GNT_PROGRESS_BAR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNT_TYPE_PROGRESS_BAR, GntProgressBar)) +#define GNT_PROGRESS_BAR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNT_TYPE_PROGRESS_BAR, GntProgressBarClass)) +#define GNT_IS_PROGRESS_BAR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNT_TYPE_PROGRESS_BAR)) +#define GNT_IS_PROGRESS_BAR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GNT_TYPE_PROGRESS_BAR)) +#define GNT_PROGRESS_BAR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GNT_TYPE_PROGRESS_BAR, GntProgressBarClass)) + +typedef enum _GntProgressBarOrientation +{ + GNT_PROGRESS_LEFT_TO_RIGHT, + GNT_PROGRESS_RIGHT_TO_LEFT, + GNT_PROGRESS_BOTTOM_TO_TOP, + GNT_PROGRESS_TOP_TO_BOTTOM, +} GntProgressBarOrientation; + +typedef struct _GntProgressBar GntProgressBar; + +typedef struct _GntProgressBarClass +{ + GntWidgetClass parent; + + void (*gnt_reserved1)(void); + void (*gnt_reserved2)(void); + void (*gnt_reserved3)(void); + void (*gnt_reserved4)(void); +} GntProgressBarClass; + +G_BEGIN_DECLS + +/** + * Get the GType for GntProgressBar + * @return The GType for GntProrgressBar + **/ +GType +gnt_progress_bar_get_type (void); + +/** + * Create a new GntProgressBar + * @return The new GntProgressBar + **/ +GntWidget * +gnt_progress_bar_new (void); + +/** + * Set the progress for a progress bar + * + * @param pbar The GntProgressBar + * @param fraction The value between 0 and 1 to display + **/ +void +gnt_progress_bar_set_fraction (GntProgressBar *pbar, gdouble fraction); + +/** + * Set the orientation for a progress bar + * + * @param pbar The GntProgressBar + * @param orientation The orientation to use + **/ +void +gnt_progress_bar_set_orientation (GntProgressBar *pbar, GntProgressBarOrientation orientation); + +/** + * Controls whether the progress value is shown + * + * @param pbar The GntProgressBar + * @param show A boolean indicating if the value is shown + **/ +void +gnt_progress_bar_set_show_progress (GntProgressBar *pbar, gboolean show); + +/** + * Get the progress that is displayed + * + * @param pbar The GntProgressBar + * @return The progress displayed as a value between 0 and 1 + **/ +gdouble +gnt_progress_bar_get_fraction (GntProgressBar *pbar); + +/** + * Get the orientation for the progress bar + * + * @param pbar The GntProgressBar + * @return The current orientation of the progress bar + **/ +GntProgressBarOrientation +gnt_progress_bar_get_orientation (GntProgressBar *pbar); + +/** + * Get a boolean describing if the progress value is shown + * + * @param pbar The GntProgressBar + * @return A boolean @c true if the progress value is shown, @c false otherwise. + **/ +gboolean +gnt_progress_bar_get_show_progress (GntProgressBar *pbar); + +G_END_DECLS + +#endif /* GNT_PROGRESS_BAR_H */
--- a/finch/libgnt/gnttextview.c Fri Apr 17 21:29:11 2009 +0000 +++ b/finch/libgnt/gnttextview.c Fri Apr 17 21:29:18 2009 +0000 @@ -799,6 +799,7 @@ break; } } + gnt_widget_draw(GNT_WIDGET(view)); return count; }
--- a/finch/libgnt/gnttree.c Fri Apr 17 21:29:11 2009 +0000 +++ b/finch/libgnt/gnttree.c Fri Apr 17 21:29:18 2009 +0000 @@ -432,7 +432,7 @@ if (tree->top == NULL) tree->top = tree->root; - if (tree->current == NULL) { + if (tree->current == NULL && tree->root != NULL) { tree->current = tree->root; tree_selection_changed(tree, NULL, tree->current); } @@ -491,6 +491,13 @@ tree->top = get_next(tree->top); row = tree->top; scrcol = widget->priv.width - 1 - 2 * pos; /* exclude the borders and the scrollbar */ + + if (tree->current && !row_matches_search(tree->current)) { + GntTreeRow *old = tree->current; + tree->current = tree->top; + tree_selection_changed(tree, old, tree->current); + } + for (i = start + pos; row && i < widget->priv.height - pos; i++, row = get_next(row)) {
--- a/finch/plugins/Makefile.am Fri Apr 17 21:29:11 2009 +0000 +++ b/finch/plugins/Makefile.am Fri Apr 17 21:29:18 2009 +0000 @@ -2,6 +2,7 @@ gntgf_la_LDFLAGS = -module -avoid-version gnthistory_la_LDFLAGS = -module -avoid-version gntlastlog_la_LDFLAGS = -module -avoid-version +gnttinyurl_la_LDFLAGS = -module -avoid-version grouping_la_LDFLAGS = -module -avoid-version if PLUGINS @@ -11,6 +12,7 @@ gntgf.la \ gnthistory.la \ gntlastlog.la \ + gnttinyurl.la \ grouping.la plugindir = $(libdir)/finch @@ -19,6 +21,7 @@ gntgf_la_SOURCES = gntgf.c gnthistory_la_SOURCES = gnthistory.c gntlastlog_la_SOURCES = lastlog.c +gnttinyurl_la_SOURCES = gnttinyurl.c grouping_la_SOURCES = grouping.c gntclipboard_la_CFLAGS = $(X11_CFLAGS) @@ -28,6 +31,7 @@ gntgf_la_LIBADD = $(GLIB_LIBS) $(X11_LIBS) $(top_builddir)/finch/libgnt/libgnt.la gnthistory_la_LIBADD = $(GLIB_LIBS) gntlastlog_la_LIBADD = $(GLIB_LIBS) +gnttinyurl_la_LIBADD = $(GLIB_LIBS) grouping_la_LIBADD = $(GLIB_LIBS) $(top_builddir)/finch/libgnt/libgnt.la endif # PLUGINS
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/finch/plugins/gnttinyurl.c Fri Apr 17 21:29:18 2009 +0000 @@ -0,0 +1,415 @@ +/** + * @file gnttinyurl.c + * + * Copyright (C) 2009 Richard Nelson <wabz@whatsbeef.net> + * + * 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 "internal.h" +#include <glib.h> + +#define PLUGIN_STATIC_NAME TinyURL +#define PREFS_BASE "/plugins/gnt/tinyurl" +#define PREF_LENGTH PREFS_BASE "/length" +#define PREF_URL PREFS_BASE "/url" + + +#include <conversation.h> +#include <signals.h> + +#include <glib.h> + +#include <plugin.h> +#include <version.h> +#include <debug.h> +#include <notify.h> + +#include <gntconv.h> + +#include <gntplugin.h> +#include <gnttextview.h> + +static int tag_num = 0; + +typedef struct +{ + PurpleConversation *conv; + gchar *tag; + int num; +} CbInfo; + +/* 3 functions from util.c */ +static gboolean +badchar(char c) +{ + switch (c) { + case ' ': + case ',': + case '\0': + case '\n': + case '\r': + case '<': + case '>': + case '"': + case '\'': + return TRUE; + default: + return FALSE; + } +} + +static gboolean +badentity(const char *c) +{ + if (!g_ascii_strncasecmp(c, "<", 4) || + !g_ascii_strncasecmp(c, ">", 4) || + !g_ascii_strncasecmp(c, """, 6)) { + return TRUE; + } + return FALSE; +} + +static GList *extract_urls(char *text) { + const char *t, *c, *q = NULL; + char *url_buf; + GList *ret = NULL; + gboolean inside_html = FALSE; + int inside_paren = 0; + c = text; + while (*c) { + if (*c == '(' && !inside_html) { + inside_paren++; + c++; + } + if (inside_html) { + if (*c == '>') { + inside_html = FALSE; + } else if (!q && (*c == '\"' || *c == '\'')) { + q = c; + } else if(q) { + if(*c == *q) + q = NULL; + } + } else if (*c == '<') { + inside_html = TRUE; + if (!g_ascii_strncasecmp(c, "<A", 2)) { + while (1) { + if (*c == '>') { + inside_html = FALSE; + break; + } + c++; + if (!(*c)) + break; + } + } + } else if ((*c=='h') && (!g_ascii_strncasecmp(c, "http://", 7) || + (!g_ascii_strncasecmp(c, "https://", 8)))) { + t = c; + while (1) { + if (badchar(*t) || badentity(t)) { + + if ((!g_ascii_strncasecmp(c, "http://", 7) && (t - c == 7)) || + (!g_ascii_strncasecmp(c, "https://", 8) && (t - c == 8))) { + break; + } + + if (*(t) == ',' && (*(t + 1) != ' ')) { + t++; + continue; + } + + if (*(t - 1) == '.') + t--; + if ((*(t - 1) == ')' && (inside_paren > 0))) { + t--; + } + + url_buf = g_strndup(c, t - c); + if (!g_list_find_custom(ret, url_buf, (GCompareFunc)strcmp)) { + purple_debug_info("TinyURL", "Added URL %s\n", url_buf); + ret = g_list_append(ret, g_strdup(url_buf)); + } + c = t; + break; + } + t++; + + } + } else if (!g_ascii_strncasecmp(c, "www.", 4) && (c == text || badchar(c[-1]) || badentity(c-1))) { + if (c[4] != '.') { + t = c; + while (1) { + if (badchar(*t) || badentity(t)) { + if (t - c == 4) { + break; + } + + if (*(t) == ',' && (*(t + 1) != ' ')) { + t++; + continue; + } + + if (*(t - 1) == '.') + t--; + if ((*(t - 1) == ')' && (inside_paren > 0))) { + t--; + } + url_buf = g_strndup(c, t - c); + if (!g_list_find_custom(ret, url_buf, (GCompareFunc)strcmp)) { + purple_debug_info("TinyURL", "Added URL %s\n", url_buf); + ret = g_list_append(ret, url_buf); + } + c = t; + break; + } + t++; + } + } + } + if (*c == ')' && !inside_html) { + inside_paren--; + c++; + } + if (*c == 0) + break; + c++; + } + return ret; +} + +static void url_fetched(PurpleUtilFetchUrlData *url_data, gpointer cb_data, + const gchar *url_text, gsize len, const gchar *error_message) +{ + CbInfo *data = (CbInfo *)cb_data; + PurpleConversation *conv = data->conv; + GList *convs = purple_get_conversations(); + /* ensure the conversation still exists */ + for (; convs; convs = convs->next) { + if ((PurpleConversation *)(convs->data) == conv) { + FinchConv *fconv = FINCH_CONV(conv); + gchar *str = g_strdup_printf("[%d] %s", data->num, url_text); + GntTextView *tv = GNT_TEXT_VIEW(fconv->tv); + gnt_text_view_tag_change(tv, data->tag, str, FALSE); + g_free(str); + g_free(data->tag); + return; + } + } + g_free(data->tag); + purple_debug_info("TinyURL", "Conversation no longer exists... :(\n"); +} + +static void free_urls(gpointer data, gpointer null) +{ + g_free(data); +} + +static gboolean receiving_msg(PurpleAccount *account, char **sender, char **message, + PurpleConversation *conv, PurpleMessageFlags *flags) { + GString *t; + GList *iter, *urls; + int c = 0; + + if (!(*flags & PURPLE_MESSAGE_RECV) || *flags & PURPLE_MESSAGE_INVISIBLE) + return FALSE; + + t = g_string_new(*message); + urls = purple_conversation_get_data(conv, "TinyURLs"); + if (urls != NULL) /* message was cancelled somewhere? Reset. */ + g_list_foreach(urls, free_urls, NULL); + g_list_free(urls); + urls = extract_urls(t->str); + g_free(*message); + for (iter = urls; iter; iter = iter->next) { + if (g_utf8_strlen((char *)iter->data, -1) >= purple_prefs_get_int(PREF_LENGTH)) { + int pos, x = 0; + gchar *j, *s, *str, *orig; + glong len = g_utf8_strlen(iter->data, -1); + s = g_strdup(t->str); + orig = s; + str = g_strdup_printf("[%d]", ++c); + while ((j = strstr(s, iter->data))) { /* replace all occurrences */ + pos = j - orig + (x++ * 3); + s = j + len; + t = g_string_insert(t, pos + len, str); + if (*s == '\0') break; + } + g_free(orig); + g_free(str); + continue; + } else { + if (iter->prev) { + iter = iter->prev; + g_free(iter->next->data); + urls = g_list_delete_link(urls, iter->next); + } else { + g_free(iter->data); + g_list_free(urls); + urls = NULL; + } + } + } + *message = t->str; + g_string_free(t, FALSE); + if (conv == NULL) + conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, *sender); + purple_conversation_set_data(conv, "TinyURLs", urls); + return FALSE; +} + +static void received_msg(PurpleAccount *account, char *sender, char *message, + PurpleConversation *conv, PurpleMessageFlags flags) { + int c; + GList *urls, *iter; + FinchConv *fconv = FINCH_CONV(conv); + GntTextView *tv = GNT_TEXT_VIEW(fconv->tv); + + urls = purple_conversation_get_data(conv, "TinyURLs"); + if (!(flags & PURPLE_MESSAGE_RECV) || urls == NULL) + return; + + for (iter = urls, c = 0; iter; iter = iter->next) { + int i; + CbInfo *cbdata; + gchar *url, *str, *tmp; + cbdata = g_new(CbInfo, 1); + cbdata->num = ++c; + cbdata->tag = g_strdup_printf("%s%d", "tiny_", tag_num++); + cbdata->conv = conv; + tmp = purple_unescape_html((char *)iter->data); + if (g_ascii_strncasecmp(tmp, "http://", 7) && g_ascii_strncasecmp(tmp, "https://", 8)) { + url = g_strdup_printf("%shttp%%3A%%2F%%2F%s", purple_prefs_get_string(PREF_URL), purple_url_encode(tmp)); + } else { + url = g_strdup_printf("%s%s", purple_prefs_get_string(PREF_URL), purple_url_encode(tmp)); + } + g_free(tmp); + purple_util_fetch_url(url, TRUE, "finch", FALSE, url_fetched, cbdata); + i = gnt_text_view_get_lines_below(tv); + str = g_strdup_printf(_("\nFetching TinyURL...")); + gnt_text_view_append_text_with_tag((tv), str, GNT_TEXT_FLAG_DIM, cbdata->tag); + g_free(str); + if (i == 0) + gnt_text_view_scroll(tv, 0); + g_free(iter->data); + g_free(url); + } + g_list_free(urls); + purple_conversation_set_data(conv, "TinyURLs", NULL); +} + +static void +free_conv_urls(PurpleConversation *conv) +{ + GList *urls = purple_conversation_get_data(conv, "TinyURLs"); + if (urls) + g_list_foreach(urls, free_urls, NULL); + g_list_free(urls); +} + +static gboolean +plugin_load(PurplePlugin *plugin) { + purple_signal_connect(purple_conversations_get_handle(), + "wrote-im-msg", + plugin, PURPLE_CALLBACK(received_msg), NULL); + purple_signal_connect(purple_conversations_get_handle(), + "wrote-chat-msg", + plugin, PURPLE_CALLBACK(received_msg), NULL); + purple_signal_connect(purple_conversations_get_handle(), + "receiving-im-msg", + plugin, PURPLE_CALLBACK(receiving_msg), NULL); + purple_signal_connect(purple_conversations_get_handle(), + "receiving-chat-msg", + plugin, PURPLE_CALLBACK(receiving_msg), NULL); + purple_signal_connect(purple_conversations_get_handle(), + "deleting-conversation", + plugin, PURPLE_CALLBACK(free_conv_urls), NULL); + + return TRUE; +} + +static PurplePluginPrefFrame * +get_plugin_pref_frame(PurplePlugin *plugin) { + + PurplePluginPrefFrame *frame; + PurplePluginPref *pref; + + frame = purple_plugin_pref_frame_new(); + + pref = purple_plugin_pref_new_with_name(PREF_LENGTH); + purple_plugin_pref_set_label(pref, _("Only create TinyURL for urls" + " of this length or greater")); + purple_plugin_pref_frame_add(frame, pref); + pref = purple_plugin_pref_new_with_name(PREF_URL); + purple_plugin_pref_set_label(pref, _("TinyURL (or other) address prefix")); + purple_plugin_pref_frame_add(frame, pref); + + return frame; +} + +static PurplePluginUiInfo prefs_info = { + get_plugin_pref_frame, + 0, /* page_num (Reserved) */ + NULL, /* frame (Reserved) */ + + /* padding */ + NULL, + NULL, + NULL, + NULL +}; + +static PurplePluginInfo info = +{ + PURPLE_PLUGIN_MAGIC, + PURPLE_MAJOR_VERSION, + PURPLE_MINOR_VERSION, + PURPLE_PLUGIN_STANDARD, + FINCH_PLUGIN_TYPE, + 0, + NULL, + PURPLE_PRIORITY_DEFAULT, + "TinyURL", + N_("TinyURL"), + DISPLAY_VERSION, + N_("TinyURL plugin"), + N_("When receiving a message with URL(s), TinyURL for easier copying"), + "Richard Nelson <wabz@whatsbeef.net>", + PURPLE_WEBSITE, + plugin_load, + NULL, + NULL, + NULL, + NULL, + &prefs_info, /**< prefs_info */ + NULL, + + /* padding */ + NULL, + NULL, + NULL, + NULL +}; + +static void +init_plugin(PurplePlugin *plugin) { + purple_prefs_add_none(PREFS_BASE); + purple_prefs_add_int(PREF_LENGTH, 30); + purple_prefs_add_string(PREF_URL, "http://tinyurl.com/api-create.php?url="); +} + +PURPLE_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info)
--- a/libpurple/Makefile.am Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/Makefile.am Fri Apr 17 21:29:18 2009 +0000 @@ -113,7 +113,6 @@ idle.h \ imgstore.h \ log.h \ - marshallers.h \ media.h \ media-gst.h \ mediamanager.h \ @@ -153,7 +152,7 @@ xmlnode.h \ whiteboard.h -purple_builtheaders = purple.h version.h +purple_builtheaders = purple.h version.h marshallers.h marshallers.h: marshallers.list @echo "Generating marshallers.h" @@ -280,8 +279,8 @@ $(NETWORKMANAGER_LIBS) \ $(INTLLIBS) \ $(FARSIGHT_LIBS) \ - $(GSTPROPS_LIBS) \ $(GSTREAMER_LIBS) \ + $(GSTINTERFACES_LIBS) \ -lm AM_CPPFLAGS = \ @@ -295,8 +294,8 @@ $(DBUS_CFLAGS) \ $(LIBXML_CFLAGS) \ $(FARSIGHT_CFLAGS) \ - $(GSTPROPS_CFLAGS) \ $(GSTREAMER_CFLAGS) \ + $(GSTINTERFACES_CFLAGS) \ $(NETWORKMANAGER_CFLAGS) # INSTALL_SSL_CERTIFICATES is true when SSL_CERTIFICATES_DIR is empty.
--- a/libpurple/Makefile.mingw Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/Makefile.mingw Fri Apr 17 21:29:18 2009 +0000 @@ -35,6 +35,7 @@ buddyicon.c \ certificate.c \ cipher.c \ + circbuffer.c \ cmds.c \ connection.c \ conversation.c \ @@ -44,10 +45,11 @@ dnssrv.c \ eventloop.c \ ft.c \ - circbuffer.c \ idle.c \ imgstore.c \ log.c \ + media.c \ + mediamanager.c \ mime.c \ nat-pmp.c \ network.c \ @@ -66,22 +68,22 @@ server.c \ signals.c \ smiley.c \ - sound.c \ + sound-theme-loader.c \ sound-theme.c \ - sound-theme-loader.c \ + sound.c \ sslconn.c \ status.c \ stringref.c \ stun.c \ - theme.c \ theme-loader.c \ theme-manager.c \ + theme.c \ upnp.c \ util.c \ value.c \ version.c \ + whiteboard.c \ xmlnode.c \ - whiteboard.c \ win32/giowin32.c \ win32/libc_interface.c \ win32/win32dep.c
--- a/libpurple/account.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/account.c Fri Apr 17 21:29:18 2009 +0000 @@ -2797,4 +2797,7 @@ purple_signals_disconnect_by_handle(handle); purple_signals_unregister_by_instance(handle); + + for (; accounts; accounts = g_list_delete_link(accounts, accounts)) + purple_account_destroy(accounts->data); }
--- a/libpurple/blist.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/blist.c Fri Apr 17 21:29:18 2009 +0000 @@ -699,10 +699,23 @@ return purplebuddylist ? purplebuddylist->root : NULL; } -GHashTable * +static void +append_buddy(gpointer key, gpointer value, gpointer user_data) +{ + GSList **list = user_data; + *list = g_slist_prepend(*list, value); +} + +GSList * purple_blist_get_buddies() { - return purplebuddylist ? purplebuddylist->buddies : NULL; + GSList *buddies = NULL; + + if (!purplebuddylist) + return NULL; + + g_hash_table_foreach(purplebuddylist->buddies, append_buddy, &buddies); + return buddies; } void * @@ -1202,6 +1215,16 @@ return chat; } +void +purple_chat_destroy(PurpleChat *chat) +{ + g_hash_table_destroy(chat->components); + g_hash_table_destroy(chat->node.settings); + g_free(chat->alias); + PURPLE_DBUS_UNREGISTER_POINTER(chat); + g_free(chat); +} + PurpleBuddy *purple_buddy_new(PurpleAccount *account, const char *name, const char *alias) { PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); @@ -1229,6 +1252,42 @@ } void +purple_buddy_destroy(PurpleBuddy *buddy) +{ + PurplePlugin *prpl; + PurplePluginProtocolInfo *prpl_info; + + /* + * Tell the owner PRPL that we're about to free the buddy so it + * can free proto_data + */ + prpl = purple_find_prpl(purple_account_get_protocol_id(buddy->account)); + if (prpl) { + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); + if (prpl_info && prpl_info->buddy_free) + prpl_info->buddy_free(buddy); + } + + /* Delete the node */ + purple_buddy_icon_unref(buddy->icon); + g_hash_table_destroy(buddy->node.settings); + purple_presence_destroy(buddy->presence); + g_free(buddy->name); + g_free(buddy->alias); + g_free(buddy->server_alias); + + PURPLE_DBUS_UNREGISTER_POINTER(buddy); + g_free(buddy); + + /* FIXME: Once PurpleBuddy is a GObject, timeout callbacks can + * g_object_ref() it when connecting the callback and + * g_object_unref() it in the handler. That way, it won't + * get freed while the timeout is pending and this line can + * be removed. */ + while (g_source_remove_by_user_data((gpointer *)buddy)); +} + +void purple_buddy_set_icon(PurpleBuddy *buddy, PurpleBuddyIcon *icon) { g_return_if_fail(buddy != NULL); @@ -1519,6 +1578,15 @@ return contact; } +void +purple_contact_destroy(PurpleContact *contact) +{ + g_hash_table_destroy(contact->node.settings); + g_free(contact->alias); + PURPLE_DBUS_UNREGISTER_POINTER(contact); + g_free(contact); +} + void purple_contact_set_alias(PurpleContact *contact, const char *alias) { purple_blist_alias_contact(contact,alias); @@ -1588,6 +1656,15 @@ return group; } +void +purple_group_destroy(PurpleGroup *group) +{ + g_hash_table_destroy(group->node.settings); + g_free(group->name); + PURPLE_DBUS_UNREGISTER_POINTER(group); + g_free(group); +} + void purple_blist_add_contact(PurpleContact *contact, PurpleGroup *group, PurpleBlistNode *node) { PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); @@ -1848,9 +1925,7 @@ ops->remove(purplebuddylist, node); /* Delete the node */ - g_hash_table_destroy(contact->node.settings); - PURPLE_DBUS_UNREGISTER_POINTER(contact); - g_free(contact); + purple_contact_destroy(contact); } } @@ -1861,8 +1936,6 @@ PurpleContact *contact; PurpleGroup *group; struct _purple_hbuddy hb; - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info = NULL; g_return_if_fail(buddy != NULL); @@ -1918,33 +1991,7 @@ /* Signal that the buddy has been removed before freeing the memory for it */ purple_signal_emit(purple_blist_get_handle(), "buddy-removed", buddy); - /* - * Tell the owner PRPL that we're about to free the buddy so it - * can free proto_data - */ - prpl = purple_find_prpl(purple_account_get_protocol_id(buddy->account)); - if (prpl) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - if (prpl_info && prpl_info->buddy_free) - prpl_info->buddy_free(buddy); - - /* Delete the node */ - purple_buddy_icon_unref(buddy->icon); - g_hash_table_destroy(buddy->node.settings); - purple_presence_destroy(buddy->presence); - g_free(buddy->name); - g_free(buddy->alias); - g_free(buddy->server_alias); - - PURPLE_DBUS_UNREGISTER_POINTER(buddy); - g_free(buddy); - - /* FIXME: Once PurpleBuddy is a GObject, timeout callbacks can - * g_object_ref() it when connecting the callback and - * g_object_unref() it in the handler. That way, it won't - * get freed while the timeout is pending and this line can - * be removed. */ - while (g_source_remove_by_user_data((gpointer *)buddy)); + purple_buddy_destroy(buddy); /* If the contact is empty then remove it */ if ((contact != NULL) && !cnode->child) @@ -1988,11 +2035,7 @@ ops->remove(purplebuddylist, node); /* Delete the node */ - g_hash_table_destroy(chat->components); - g_hash_table_destroy(chat->node.settings); - g_free(chat->alias); - PURPLE_DBUS_UNREGISTER_POINTER(chat); - g_free(chat); + purple_chat_destroy(chat); } void purple_blist_remove_group(PurpleGroup *group) @@ -2033,10 +2076,7 @@ } /* Delete the node */ - g_hash_table_destroy(group->node.settings); - g_free(group->name); - PURPLE_DBUS_UNREGISTER_POINTER(group); - g_free(group); + purple_group_destroy(group); } PurpleBuddy *purple_contact_get_priority_buddy(PurpleContact *contact) @@ -2587,6 +2627,28 @@ } static void +purple_blist_node_destroy(PurpleBlistNode *node) +{ + PurpleBlistNode *child, *next_child; + + child = node->child; + while (child) { + next_child = child->next; + purple_blist_node_destroy(child); + child = next_child; + } + + if (PURPLE_BLIST_NODE_IS_BUDDY(node)) + purple_buddy_destroy((PurpleBuddy*)node); + else if (PURPLE_BLIST_NODE_IS_CHAT(node)) + purple_chat_destroy((PurpleChat*)node); + else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) + purple_contact_destroy((PurpleContact*)node); + else if (PURPLE_BLIST_NODE_IS_GROUP(node)) + purple_group_destroy((PurpleGroup*)node); +} + +static void purple_blist_node_setting_free(gpointer data) { PurpleValue *value; @@ -2874,12 +2936,21 @@ void purple_blist_uninit(void) { - if (save_timer != 0) - { + PurpleBlistNode *node, *next_node; + + if (save_timer != 0) { purple_timeout_remove(save_timer); save_timer = 0; purple_blist_sync(); } + node = purple_blist_get_root(); + while (node) { + next_node = node->next; + purple_blist_node_destroy(node); + node = next_node; + } + purplebuddylist->root = NULL; + purple_signals_unregister_by_instance(purple_blist_get_handle()); }
--- a/libpurple/blist.h Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/blist.h Fri Apr 17 21:29:18 2009 +0000 @@ -260,13 +260,14 @@ PurpleBlistNode *purple_blist_get_root(void); /** - * Returns the hash table of every buddy in the list. + * Returns a list of every buddy in the list. * - * @return The hash table of every buddy in the list. + * @return A list of every buddy in the list. Caller is responsible for + * freeing the list. * * @since 2.6.0 */ -GHashTable *purple_blist_get_buddies(void); +GSList *purple_blist_get_buddies(void); /** * Returns the UI data for the list. @@ -478,6 +479,13 @@ PurpleChat *purple_chat_new(PurpleAccount *account, const char *alias, GHashTable *components); /** + * Destroys a chat + * + * @param chat The chat to destroy + */ +void purple_chat_destroy(PurpleChat *chat); + +/** * Adds a new chat to the buddy list. * * The chat will be inserted right after node or appended to the end @@ -501,6 +509,13 @@ PurpleBuddy *purple_buddy_new(PurpleAccount *account, const char *name, const char *alias); /** + * Destroys a buddy + * + * @param buddy The buddy to destroy + */ +void purple_buddy_destroy(PurpleBuddy *buddy); + +/** * Sets a buddy's icon. * * This should only be called from within Purple. You probably want to @@ -611,6 +626,13 @@ PurpleGroup *purple_group_new(const char *name); /** + * Destroys a group + * + * @param group The group to destroy +*/ +void purple_group_destroy(PurpleGroup *group); + +/** * Adds a new group to the buddy list. * * The new group will be inserted after insert or prepended to the list if @@ -629,6 +651,13 @@ PurpleContact *purple_contact_new(void); /** + * Destroys a contact + * + * @param contact The contact to destroy + */ +void purple_contact_destroy(PurpleContact *contact); + +/** * Adds a new contact to the buddy list. * * The new contact will be inserted after insert or prepended to the list if
--- a/libpurple/buddyicon.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/buddyicon.c Fri Apr 17 21:29:18 2009 +0000 @@ -1299,6 +1299,7 @@ g_hash_table_destroy(icon_file_cache); g_hash_table_destroy(pointer_icon_cache); g_free(old_icons_dir); + g_free(cache_dir); } void purple_buddy_icon_get_scale_size(PurpleBuddyIconSpec *spec, int *width, int *height)
--- a/libpurple/conversation.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/conversation.c Fri Apr 17 21:29:18 2009 +0000 @@ -33,7 +33,7 @@ #include "signals.h" #include "util.h" -#define SEND_TYPED_TIMEOUT 5000 +#define SEND_TYPED_TIMEOUT_SECONDS 5 static GList *conversations = NULL; static GList *ims = NULL; @@ -1122,8 +1122,9 @@ { g_return_if_fail(im != NULL); - im->send_typed_timeout = purple_timeout_add(SEND_TYPED_TIMEOUT, send_typed_cb, - purple_conv_im_get_conversation(im)); + im->send_typed_timeout = purple_timeout_add_seconds(SEND_TYPED_TIMEOUT_SECONDS, + send_typed_cb, + purple_conv_im_get_conversation(im)); } void @@ -2004,6 +2005,66 @@ purple_conversation_update(chat->conv, PURPLE_CONV_UPDATE_CHATLEFT); } +static void +invite_user_to_chat(gpointer data, PurpleRequestFields *fields) +{ + PurpleConversation *conv; + PurpleConvChat *chat; + const char *user, *message; + + conv = data; + chat = PURPLE_CONV_CHAT(conv); + user = purple_request_fields_get_string(fields, "screenname"); + message = purple_request_fields_get_string(fields, "message"); + + serv_chat_invite(purple_conversation_get_gc(conv), chat->id, message, user); +} + +void purple_conv_chat_invite_user(PurpleConvChat *chat, const char *user, + const char *message, gboolean confirm) +{ + PurpleAccount *account; + PurpleConversation *conv; + PurpleRequestFields *fields; + PurpleRequestFieldGroup *group; + PurpleRequestField *field; + + g_return_if_fail(chat); + + if (!user || !*user || !message || !*message) + confirm = TRUE; + + conv = chat->conv; + account = conv->account; + + if (!confirm) { + serv_chat_invite(purple_account_get_connection(account), + purple_conv_chat_get_id(chat), message, user); + return; + } + + fields = purple_request_fields_new(); + group = purple_request_field_group_new(_("Invite to chat")); + purple_request_fields_add_group(fields, group); + + field = purple_request_field_string_new("screenname", _("Buddy"), user, FALSE); + purple_request_field_group_add_field(group, field); + purple_request_field_set_required(field, TRUE); + purple_request_field_set_type_hint(field, "screenname"); + + field = purple_request_field_string_new("message", _("Message"), message, FALSE); + purple_request_field_group_add_field(group, field); + + purple_request_fields(conv, _("Invite to chat"), NULL, + _("Please enter the name of the user you wish to invite, " + "along with an optional invite message."), + fields, + _("Invite"), G_CALLBACK(invite_user_to_chat), + _("Cancel"), NULL, + account, user, conv, + conv); +} + gboolean purple_conv_chat_has_left(PurpleConvChat *chat) {
--- a/libpurple/conversation.h Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/conversation.h Fri Apr 17 21:29:18 2009 +0000 @@ -1300,6 +1300,22 @@ void purple_conv_chat_left(PurpleConvChat *chat); /** + * Invite a user to a chat. + * The user will be prompted to enter the user's name or a message if one is + * not given. + * + * @param chat The chat. + * @param user The user to invite to the chat. + * @param message The message to send with the invitation. + * @param confirm Prompt before sending the invitation. The user is always + * prompted if either #user or #message is @c NULL. + * + * @since 2.6.0 + */ +void purple_conv_chat_invite_user(PurpleConvChat *chat, const char *user, + const char *message, gboolean confirm); + +/** * Returns true if we're no longer in this chat, * and just left the window open. *
--- a/libpurple/core.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/core.c Fri Apr 17 21:29:18 2009 +0000 @@ -216,15 +216,10 @@ /* The SSL plugins must be uninit before they're unloaded */ purple_ssl_uninit(); - /* Unload all plugins before the UI because UI plugins might call - * UI-specific functions */ - purple_debug_info("main", "Unloading all plugins\n"); - purple_plugins_destroy_all(); - - /* Shut down the UI before all the subsystems */ - ops = purple_core_get_ui_ops(); - if (ops != NULL && ops->quit != NULL) - ops->quit(); + /* Unload all non-loader, non-prpl plugins before shutting down + * subsystems. */ + purple_debug_info("main", "Unloading normal plugins\n"); + purple_plugins_unload(PURPLE_PLUGIN_STANDARD); /* Save .xml files, remove signals, etc. */ purple_smileys_uninit(); @@ -247,7 +242,16 @@ purple_imgstore_uninit(); purple_network_uninit(); - /* Everything after this must not try to read any prefs */ + /* Everything after unloading all plugins must not fail if prpls aren't + * around */ + purple_debug_info("main", "Unloading all plugins\n"); + purple_plugins_destroy_all(); + + ops = purple_core_get_ui_ops(); + if (ops != NULL && ops->quit != NULL) + ops->quit(); + + /* Everything after prefs_uninit must not try to read any prefs */ purple_prefs_uninit(); purple_plugins_uninit(); #ifdef HAVE_DBUS @@ -255,8 +259,9 @@ #endif purple_cmds_uninit(); - /* Everything after this cannot try to write things to the confdir */ + /* Everything after util_uninit cannot try to write things to the confdir */ purple_util_uninit(); + purple_log_uninit(); purple_signals_uninit();
--- a/libpurple/ft.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/ft.c Fri Apr 17 21:29:18 2009 +0000 @@ -458,7 +458,7 @@ { PurpleXferType type; struct stat st; - char *msg, *utf8; + char *msg, *utf8, *base; PurpleAccount *account; PurpleBuddy *buddy; @@ -505,7 +505,9 @@ purple_xfer_set_local_filename(xfer, filename); purple_xfer_set_size(xfer, st.st_size); - utf8 = g_filename_to_utf8(g_basename(filename), -1, NULL, NULL, NULL); + base = g_path_get_basename(filename); + utf8 = g_filename_to_utf8(base, -1, NULL, NULL, NULL); + g_free(base); purple_xfer_set_filename(xfer, utf8); msg = g_strdup_printf(_("Offering to send %s to %s"),
--- a/libpurple/internal.h Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/internal.h Fri Apr 17 21:29:18 2009 +0000 @@ -222,7 +222,6 @@ # endif #endif -#include <glib.h> #include <glib-object.h> #ifndef G_DEFINE_TYPE
--- a/libpurple/media.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/media.c Fri Apr 17 21:29:18 2009 +0000 @@ -28,15 +28,18 @@ #include "internal.h" -#include "connection.h" -#include "marshallers.h" +#include "account.h" #include "media.h" -#include "media-gst.h" #include "mediamanager.h" #include "network.h" #include "debug.h" +#ifdef USE_GSTREAMER +#include "marshallers.h" +#include "media-gst.h" +#endif + #ifdef USE_VV #include <gst/farsight/fs-conference-iface.h> @@ -109,7 +112,7 @@ { #ifdef USE_VV PurpleMediaManager *manager; - PurpleConnection *pc; + PurpleAccount *account; FsConference *conference; gboolean initiator; gpointer prpl_data; @@ -166,7 +169,7 @@ enum { PROP_0, PROP_MANAGER, - PROP_CONNECTION, + PROP_ACCOUNT, PROP_CONFERENCE, PROP_INITIATOR, PROP_PRPL_DATA, @@ -298,10 +301,10 @@ PURPLE_TYPE_MEDIA_MANAGER, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, PROP_CONNECTION, - g_param_spec_pointer("connection", - "PurpleConnection", - "The connection this media session is on.", + g_object_class_install_property(gobject_class, PROP_ACCOUNT, + g_param_spec_pointer("account", + "PurpleAccount", + "The account this media session is on.", G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); g_object_class_install_property(gobject_class, PROP_CONFERENCE, @@ -528,8 +531,8 @@ purple_media_setup_pipeline(media); break; - case PROP_CONNECTION: - media->priv->pc = g_value_get_pointer(value); + case PROP_ACCOUNT: + media->priv->account = g_value_get_pointer(value); break; case PROP_CONFERENCE: { if (media->priv->conference) @@ -564,8 +567,8 @@ case PROP_MANAGER: g_value_set_object(value, media->priv->manager); break; - case PROP_CONNECTION: - g_value_set_pointer(value, media->priv->pc); + case PROP_ACCOUNT: + g_value_set_pointer(value, media->priv->account); break; case PROP_CONFERENCE: g_value_set_object(value, media->priv->conference); @@ -1908,6 +1911,7 @@ } #endif +#ifdef USE_GSTREAMER GstElement * purple_media_get_src(PurpleMedia *media, const gchar *sess_id) { @@ -1920,6 +1924,7 @@ return NULL; #endif } +#endif /* USE_GSTREAMER */ #ifdef USE_VV static PurpleMediaSession * @@ -2055,14 +2060,14 @@ } #endif -PurpleConnection * -purple_media_get_connection(PurpleMedia *media) +PurpleAccount * +purple_media_get_account(PurpleMedia *media) { #ifdef USE_VV - PurpleConnection *pc; + PurpleAccount *account; g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); - g_object_get(G_OBJECT(media), "connection", &pc, NULL); - return pc; + g_object_get(G_OBJECT(media), "account", &account, NULL); + return account; #else return NULL; #endif @@ -3034,6 +3039,7 @@ #endif } +#ifdef USE_GSTREAMER GstElement * purple_media_get_tee(PurpleMedia *media, const gchar *session_id, const gchar *participant) @@ -3056,4 +3062,5 @@ return NULL; #endif } - +#endif /* USE_GSTREAMER */ +
--- a/libpurple/media.h Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/media.h Fri Apr 17 21:29:18 2009 +0000 @@ -362,15 +362,15 @@ GList *purple_media_get_session_names(PurpleMedia *media); /** - * Gets the PurpleConnection this media session is on. + * Gets the PurpleAccount this media session is on. * - * @param media The media session to retrieve the connection from. + * @param media The media session to retrieve the account from. * - * @return The connection retrieved. + * @return The account retrieved. * * @since 2.6.0 */ -PurpleConnection *purple_media_get_connection(PurpleMedia *media); +PurpleAccount *purple_media_get_account(PurpleMedia *media); /** * Gets the prpl data from the media session.
--- a/libpurple/mediamanager.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/mediamanager.c Fri Apr 17 21:29:18 2009 +0000 @@ -26,12 +26,15 @@ #include "internal.h" -#include "connection.h" +#include "account.h" #include "debug.h" +#include "media.h" +#include "mediamanager.h" + +#ifdef USE_GSTREAMER #include "marshallers.h" -#include "media.h" #include "media-gst.h" -#include "mediamanager.h" +#endif #ifdef USE_VV @@ -218,6 +221,7 @@ } #endif +#ifdef USE_GSTREAMER GstElement * purple_media_manager_get_pipeline(PurpleMediaManager *manager) { @@ -246,10 +250,11 @@ return NULL; #endif } +#endif /* USE_GSTREAMER */ PurpleMedia * purple_media_manager_create_media(PurpleMediaManager *manager, - PurpleConnection *gc, + PurpleAccount *account, const char *conference_type, const char *remote_user, gboolean initiator) @@ -261,8 +266,7 @@ gboolean signal_ret; if (conference == NULL) { - purple_conv_present_error(remote_user, - purple_connection_get_account(gc), + purple_conv_present_error(remote_user, account, _("Error creating conference.")); purple_debug_error("media", "Conference == NULL\n"); return NULL; @@ -270,7 +274,7 @@ media = PURPLE_MEDIA(g_object_new(purple_media_get_type(), "manager", manager, - "connection", gc, + "account", account, "conference", conference, "initiator", initiator, NULL)); @@ -278,8 +282,7 @@ ret = gst_element_set_state(GST_ELEMENT(conference), GST_STATE_PLAYING); if (ret == GST_STATE_CHANGE_FAILURE) { - purple_conv_present_error(remote_user, - purple_connection_get_account(gc), + purple_conv_present_error(remote_user, account, _("Error creating conference.")); purple_debug_error("media", "Failed to start conference.\n"); g_object_unref(media); @@ -287,7 +290,7 @@ } g_signal_emit(manager, purple_media_manager_signals[INIT_MEDIA], 0, - media, gc, remote_user, &signal_ret); + media, account, remote_user, &signal_ret); if (signal_ret == FALSE) { g_object_unref(media); @@ -312,8 +315,8 @@ } GList * -purple_media_manager_get_media_by_connection(PurpleMediaManager *manager, - PurpleConnection *pc) +purple_media_manager_get_media_by_account(PurpleMediaManager *manager, + PurpleAccount *account) { #ifdef USE_VV GList *media = NULL; @@ -323,7 +326,7 @@ iter = manager->priv->medias; for (; iter; iter = g_list_next(iter)) { - if (purple_media_get_connection(iter->data) == pc) { + if (purple_media_get_account(iter->data) == account) { media = g_list_prepend(media, iter->data); } } @@ -368,6 +371,7 @@ } #endif +#ifdef USE_GSTREAMER GstElement * purple_media_manager_get_element(PurpleMediaManager *manager, PurpleMediaSessionType type, PurpleMedia *media, @@ -497,7 +501,6 @@ g_object_unref(info2); return FALSE; } - g_object_unref(info2); manager->priv->elements = g_list_prepend(manager->priv->elements, info); @@ -560,7 +563,8 @@ if (info2 == NULL) purple_media_manager_register_element(manager, info); - g_object_unref(info2); + else + g_object_unref(info2); type = purple_media_element_info_get_element_type(info); @@ -613,6 +617,7 @@ return NULL; } +#endif /* USE_GSTREAMER */ #ifdef USE_VV static void @@ -846,6 +851,7 @@ #endif } +#ifdef USE_GSTREAMER /* * PurpleMediaElementType @@ -1117,3 +1123,5 @@ return NULL; } +#endif /* USE_GSTREAMER */ +
--- a/libpurple/mediamanager.h Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/mediamanager.h Fri Apr 17 21:29:18 2009 +0000 @@ -35,7 +35,7 @@ /** @copydoc _PurpleMediaManagerClass */ typedef struct _PurpleMediaManagerClass PurpleMediaManagerClass; -#include "connection.h" +#include "account.h" #include "media.h" G_BEGIN_DECLS @@ -78,7 +78,7 @@ * Creates a media session. * * @param manager The media manager to create the session under. - * @param gc The connection to create the session on. + * @param account The account to create the session on. * @param conference_type The conference type to feed into Farsight2. * @param remote_user The remote user to initiate the session with. * @@ -87,7 +87,7 @@ * @since 2.6.0 */ PurpleMedia *purple_media_manager_create_media(PurpleMediaManager *manager, - PurpleConnection *gc, + PurpleAccount *account, const char *conference_type, const char *remote_user, gboolean initiator); @@ -104,17 +104,17 @@ GList *purple_media_manager_get_media(PurpleMediaManager *manager); /** - * Gets all of the media sessions for a given connection. + * Gets all of the media sessions for a given account. * * @param manager The media manager to get the sessions from. - * @param pc The connection the sessions are on. + * @param account The account the sessions are on. * - * @return A list of the media sessions on the given connection. + * @return A list of the media sessions on the given account. * * @since 2.6.0 */ -GList *purple_media_manager_get_media_by_connection( - PurpleMediaManager *manager, PurpleConnection *pc); +GList *purple_media_manager_get_media_by_account( + PurpleMediaManager *manager, PurpleAccount *account); /** * Removes a media session from the media manager.
--- a/libpurple/mime.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/mime.c Fri Apr 17 21:29:18 2009 +0000 @@ -25,9 +25,6 @@ #include <string.h> #include <glib.h> -#include <glib/ghash.h> -#include <glib/glist.h> -#include <glib/gstring.h> #include "internal.h"
--- a/libpurple/mime.h Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/mime.h Fri Apr 17 21:29:18 2009 +0000 @@ -25,7 +25,6 @@ #define _PURPLE_MIME_H #include <glib.h> -#include <glib/glist.h> #ifdef __cplusplus extern "C" {
--- a/libpurple/network.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/network.c Fri Apr 17 21:29:18 2009 +0000 @@ -825,8 +825,13 @@ *ip = g_strdup(dst); purple_debug_info("network", "set IP address: %s\n", *ip); } - - g_slist_free(hosts); + + while (hosts != NULL) { + hosts = g_slist_delete_link(hosts, hosts); + /* Free the address */ + g_free(hosts->data); + hosts = g_slist_delete_link(hosts, hosts); + } } void
--- a/libpurple/plugin.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/plugin.c Fri Apr 17 21:29:18 2009 +0000 @@ -1201,6 +1201,11 @@ purple_signals_disconnect_by_handle(handle); purple_signals_unregister_by_instance(handle); + + while (search_paths) { + g_free(search_paths->data); + search_paths = g_list_delete_link(search_paths, search_paths); + } } /************************************************************************** @@ -1229,6 +1234,21 @@ } void +purple_plugins_unload(PurplePluginType type) +{ +#ifdef PURPLE_PLUGINS + GList *l; + + for (l = plugins; l; l = l->next) { + PurplePlugin *plugin = l->data; + if (plugin->info->type == type && purple_plugin_is_loaded(plugin)) + purple_plugin_unload(plugin); + } + +#endif /* PURPLE_PLUGINS */ +} + +void purple_plugins_destroy_all(void) { #ifdef PURPLE_PLUGINS
--- a/libpurple/plugin.h Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/plugin.h Fri Apr 17 21:29:18 2009 +0000 @@ -29,7 +29,7 @@ #ifndef _PURPLE_PLUGIN_H_ #define _PURPLE_PLUGIN_H_ -#include <glib/glist.h> +#include <glib.h> #include <gmodule.h> #include "signals.h" #include "value.h" @@ -503,6 +503,11 @@ void purple_plugins_unload_all(void); /** + * Unloads all plugins of a specific type. + */ +void purple_plugins_unload(PurplePluginType type); + +/** * Destroys all registered plugins. */ void purple_plugins_destroy_all(void);
--- a/libpurple/plugins/filectl.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/plugins/filectl.c Fri Apr 17 21:29:18 2009 +0000 @@ -220,7 +220,7 @@ plugin_load(PurplePlugin *plugin) { init_file(); - check = purple_timeout_add(5000, (GSourceFunc)check_file, NULL); + check = purple_timeout_add_seconds(5, (GSourceFunc)check_file, NULL); return TRUE; }
--- a/libpurple/plugins/joinpart.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/plugins/joinpart.c Fri Apr 17 21:29:18 2009 +0000 @@ -194,7 +194,7 @@ PURPLE_CALLBACK(received_chat_msg_cb), users); /* Cleanup every 5 minutes */ - id = purple_timeout_add(1000 * 60 * 5, (GSourceFunc)clean_users_hash, users); + id = purple_timeout_add_seconds(60 * 5, (GSourceFunc)clean_users_hash, users); data = g_new(gpointer, 2); data[0] = users;
--- a/libpurple/protocols/bonjour/jabber.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/bonjour/jabber.c Fri Apr 17 21:29:18 2009 +0000 @@ -237,7 +237,7 @@ }; static void -_match_buddies_by_address(gpointer key, gpointer value, gpointer data) +_match_buddies_by_address(gpointer value, gpointer data) { PurpleBuddy *pb = value; PurpleAccount *account = NULL; @@ -638,6 +638,7 @@ char *address_text = NULL; struct _match_buddies_by_address_t *mbba; BonjourJabberConversation *bconv; + GSList *buddies; /* Check that it is a read condition */ if (condition != PURPLE_INPUT_READ) @@ -658,7 +659,10 @@ mbba = g_new0(struct _match_buddies_by_address_t, 1); mbba->address = address_text; mbba->jdata = jdata; - g_hash_table_foreach(purple_blist_get_buddies(), _match_buddies_by_address, mbba); + + buddies = purple_blist_get_buddies(); + g_slist_foreach(buddies, _match_buddies_by_address, mbba); + g_slist_free(buddies); if (mbba->matched_buddies == NULL) { purple_debug_info("bonjour", "We don't like invisible buddies, this is not a superheros comic\n"); @@ -850,11 +854,15 @@ bonjour_jabber_conv_match_by_ip(BonjourJabberConversation *bconv) { BonjourJabber *jdata = ((BonjourData*) bconv->account->gc->proto_data)->jabber_data; struct _match_buddies_by_address_t *mbba; + GSList *buddies; mbba = g_new0(struct _match_buddies_by_address_t, 1); mbba->address = bconv->ip; mbba->jdata = jdata; - g_hash_table_foreach(purple_blist_get_buddies(), _match_buddies_by_address, mbba); + + buddies = purple_blist_get_buddies(); + g_slist_foreach(buddies, _match_buddies_by_address, mbba); + g_slist_free(buddies); /* If there is exactly one match, use it */ if(mbba->matched_buddies != NULL) {
--- a/libpurple/protocols/irc/msgs.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/irc/msgs.c Fri Apr 17 21:29:18 2009 +0000 @@ -128,7 +128,7 @@ irc_blist_timeout(irc); if (!irc->timer) - irc->timer = purple_timeout_add(45000, (GSourceFunc)irc_blist_timeout, (gpointer)irc); + irc->timer = purple_timeout_add_seconds(45, (GSourceFunc)irc_blist_timeout, (gpointer)irc); } void irc_msg_default(struct irc_conn *irc, const char *name, const char *from, char **args)
--- a/libpurple/protocols/jabber/buddy.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/jabber/buddy.c Fri Apr 17 21:29:18 2009 +0000 @@ -1866,7 +1866,7 @@ } js->pending_buddy_info_requests = g_slist_prepend(js->pending_buddy_info_requests, jbi); - jbi->timeout_handle = purple_timeout_add(30000, jabber_buddy_get_info_timeout, jbi); + jbi->timeout_handle = purple_timeout_add_seconds(30, jabber_buddy_get_info_timeout, jbi); } void jabber_buddy_get_info(PurpleConnection *gc, const char *who)
--- a/libpurple/protocols/jabber/google.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/jabber/google.c Fri Apr 17 21:29:18 2009 +0000 @@ -340,7 +340,8 @@ session->remote_jid = jid; session->media = purple_media_manager_create_media( - purple_media_manager_get(), js->gc, + purple_media_manager_get(), + purple_connection_get_account(js->gc), "fsrtpconference", session->remote_jid, TRUE); purple_media_set_prpl_data(session->media, session); @@ -389,8 +390,10 @@ return; } - session->media = purple_media_manager_create_media(purple_media_manager_get(), js->gc, - "fsrtpconference", session->remote_jid, FALSE); + session->media = purple_media_manager_create_media( + purple_media_manager_get(), + purple_connection_get_account(js->gc), + "fsrtpconference", session->remote_jid, FALSE); purple_media_set_prpl_data(session->media, session); @@ -572,8 +575,9 @@ if (!id.initiator) return; - iter = purple_media_manager_get_media_by_connection( - purple_media_manager_get(), js->gc); + iter = purple_media_manager_get_media_by_account( + purple_media_manager_get(), + purple_connection_get_account(js->gc)); for (; iter; iter = g_list_delete_link(iter, iter)) { GoogleSession *gsession = purple_media_get_prpl_data(iter->data); @@ -1152,7 +1156,12 @@ } } - g_slist_free(hosts); + while (hosts != NULL) { + hosts = g_slist_delete_link(hosts, hosts); + /* Free the address */ + g_free(hosts->data); + hosts = g_slist_delete_link(hosts, hosts); + } } static void
--- a/libpurple/protocols/jabber/jabber.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/jabber/jabber.c Fri Apr 17 21:29:18 2009 +0000 @@ -2614,7 +2614,7 @@ #ifdef USE_VV typedef struct { - PurpleConnection *pc; + PurpleAccount *account; gchar *who; PurpleMediaSessionType type; @@ -2637,7 +2637,7 @@ GList *labels = purple_request_field_choice_get_labels(field); gchar *who = g_strdup_printf("%s/%s", request->who, (gchar*)g_list_nth_data(labels, selected_id)); - jabber_initiate_media(request->pc, who, request->type); + jabber_initiate_media(request->account, who, request->type); g_free(who); g_free(request->who); @@ -2646,11 +2646,12 @@ #endif gboolean -jabber_initiate_media(PurpleConnection *gc, const char *who, +jabber_initiate_media(PurpleAccount *account, const char *who, PurpleMediaSessionType type) { #ifdef USE_VV - JabberStream *js = (JabberStream *) gc->proto_data; + JabberStream *js = (JabberStream *) + purple_account_get_connection(account)->proto_data; JabberBuddy *jb; JabberBuddyResource *jbr = NULL; char *resource; @@ -2675,11 +2676,9 @@ JINGLE_APP_RTP_SUPPORT_AUDIO) && jabber_resource_has_capability(jbr, GOOGLE_VOICE_CAP)) - return jabber_google_session_initiate( - gc->proto_data, who, type); + return jabber_google_session_initiate(js, who, type); else - return jingle_rtp_initiate_media( - gc->proto_data, who, type); + return jingle_rtp_initiate_media(js, who, type); } jb = jabber_buddy_find(js, who, FALSE); @@ -2698,7 +2697,7 @@ msg = g_strdup_printf(_("Unable to initiate media with %s: not subscribed to user presence"), who); } - purple_notify_error(js->gc, _("Media Initiation Failed"), + purple_notify_error(account, _("Media Initiation Failed"), _("Media Initiation Failed"), msg); g_free(msg); return FALSE; @@ -2709,7 +2708,7 @@ gboolean result; jbr = jb->resources->data; name = g_strdup_printf("%s/%s", who, jbr->name); - result = jabber_initiate_media(gc, name, type); + result = jabber_initiate_media(account, name, type); g_free(name); return result; } else { @@ -2729,7 +2728,7 @@ PurpleMediaCaps caps; gchar *name; name = g_strdup_printf("%s/%s", who, ljbr->name); - caps = jabber_get_media_caps(gc, name); + caps = jabber_get_media_caps(account, name); g_free(name); if ((type & PURPLE_MEDIA_AUDIO) && @@ -2764,7 +2763,7 @@ gboolean result; purple_request_field_destroy(field); name = g_strdup_printf("%s/%s", who, jbr->name); - result = jabber_initiate_media(gc, name, type); + result = jabber_initiate_media(account, name, type); g_free(name); return result; } @@ -2773,17 +2772,17 @@ fields = purple_request_fields_new(); group = purple_request_field_group_new(NULL); request = g_new0(JabberMediaRequest, 1); - request->pc = gc; + request->account = account; request->who = g_strdup(who); request->type = type; purple_request_field_group_add_field(group, field); purple_request_fields_add_group(fields, group); - purple_request_fields(gc, _("Select a Resource"), msg, NULL, - fields, _("Initiate Media"), + purple_request_fields(account, _("Select a Resource"), msg, + NULL, fields, _("Initiate Media"), G_CALLBACK(jabber_media_ok_cb), _("Cancel"), G_CALLBACK(jabber_media_cancel_cb), - gc->account, who, NULL, request); + account, who, NULL, request); g_free(msg); return TRUE; @@ -2792,10 +2791,11 @@ return FALSE; } -PurpleMediaCaps jabber_get_media_caps(PurpleConnection *gc, const char *who) +PurpleMediaCaps jabber_get_media_caps(PurpleAccount *account, const char *who) { #ifdef USE_VV - JabberStream *js = (JabberStream *) gc->proto_data; + JabberStream *js = (JabberStream *) + purple_account_get_connection(account)->proto_data; JabberBuddy *jb; JabberBuddyResource *jbr; PurpleMediaCaps caps = PURPLE_MEDIA_CAPS_NONE; @@ -2861,7 +2861,7 @@ gchar *name; jbr = jb->resources->data; name = g_strdup_printf("%s/%s", who, jbr->name); - caps = jabber_get_media_caps(gc, name); + caps = jabber_get_media_caps(account, name); g_free(name); } else { /* we've got multiple resources, combine their caps */ @@ -2872,7 +2872,7 @@ gchar *name; jbr = l->data; name = g_strdup_printf("%s/%s", who, jbr->name); - caps |= jabber_get_media_caps(gc, name); + caps |= jabber_get_media_caps(account, name); g_free(name); } }
--- a/libpurple/protocols/jabber/jabber.h Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/jabber/jabber.h Fri Apr 17 21:29:18 2009 +0000 @@ -323,9 +323,9 @@ gboolean jabber_offline_message(const PurpleBuddy *buddy); int jabber_prpl_send_raw(PurpleConnection *gc, const char *buf, int len); GList *jabber_actions(PurplePlugin *plugin, gpointer context); -gboolean jabber_initiate_media(PurpleConnection *gc, const char *who, +gboolean jabber_initiate_media(PurpleAccount *account, const char *who, PurpleMediaSessionType type); -PurpleMediaCaps jabber_get_media_caps(PurpleConnection *gc, const char *who); +PurpleMediaCaps jabber_get_media_caps(PurpleAccount *account, const char *who); void jabber_register_commands(void); void jabber_init_plugin(PurplePlugin *plugin);
--- a/libpurple/protocols/jabber/jingle/rtp.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/jabber/jingle/rtp.c Fri Apr 17 21:29:18 2009 +0000 @@ -204,8 +204,9 @@ { JabberStream *js = jingle_session_get_js(session); PurpleMedia *media = NULL; - GList *iter = purple_media_manager_get_media_by_connection( - purple_media_manager_get(), js->gc); + GList *iter = purple_media_manager_get_media_by_account( + purple_media_manager_get(), + purple_connection_get_account(js->gc)); for (; iter; iter = g_list_delete_link(iter, iter)) { JingleSession *media_session = @@ -466,6 +467,9 @@ { purple_debug_info("jingle-rtp", "stream-info: type %d " "id: %s name: %s\n", type, sid, name); + + g_return_if_fail(JINGLE_IS_SESSION(session)); + if (type == PURPLE_MEDIA_INFO_HANGUP) { jabber_iq_send(jingle_session_terminate_packet( session, "success")); @@ -518,9 +522,11 @@ JabberStream *js = jingle_session_get_js(session); gchar *remote_jid = jingle_session_get_remote_jid(session); - PurpleMedia *media = purple_media_manager_create_media(purple_media_manager_get(), - js->gc, "fsrtpconference", remote_jid, - jingle_session_is_initiator(session)); + PurpleMedia *media = purple_media_manager_create_media( + purple_media_manager_get(), + purple_connection_get_account(js->gc), + "fsrtpconference", remote_jid, + jingle_session_is_initiator(session)); g_free(remote_jid); if (!media) {
--- a/libpurple/protocols/msn/msg.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/msn/msg.c Fri Apr 17 21:29:18 2009 +0000 @@ -984,3 +984,67 @@ g_hash_table_destroy(body); } +void +msn_invite_msg(MsnCmdProc *cmdproc, MsnMessage *msg) +{ + GHashTable *body; + const gchar *guid; + + g_return_if_fail(cmdproc != NULL); + g_return_if_fail(msg != NULL); + + body = msn_message_get_hashtable_from_body(msg); + + if (body == NULL) { + purple_debug_warning("msn", + "Unable to parse invite msg body.\n"); + return; + } + + guid = g_hash_table_lookup(body, "Application-GUID"); + + if (guid == NULL) { + const gchar *cmd = g_hash_table_lookup( + body, "Invitation-Command"); + + if (cmd && !strcmp(cmd, "CANCEL")) { + const gchar *code = g_hash_table_lookup( + body, "Cancel-Code"); + purple_debug_info("msn", + "MSMSGS invitation cancelled: %s.\n", + code ? code : "no reason given"); + } else + purple_debug_warning("msn", "Invite msg missing " + "Application-GUID.\n"); + } else if (!strcmp(guid, "{02D3C01F-BF30-4825-A83A-DE7AF41648AA}")) { + purple_debug_info("msn", "Computer call\n"); + + if (cmdproc->session) { + PurpleConversation *conv = NULL; + gchar *from = msg->remote_user; + gchar *buf = NULL; + + if (from) + conv = purple_find_conversation_with_account( + PURPLE_CONV_TYPE_IM, from, + cmdproc->session->account); + if (conv) + buf = g_strdup_printf( + _("%s sent you a voice chat " + "invite, which is not yet " + "supported."), from); + if (buf) { + purple_conversation_write(conv, NULL, buf, + PURPLE_MESSAGE_SYSTEM | + PURPLE_MESSAGE_NOTIFY, + time(NULL)); + g_free(buf); + } + } + } else + purple_debug_warning("msn", + "Unhandled invite msg with GUID %s.\n", guid); + + g_hash_table_destroy(body); +} +
--- a/libpurple/protocols/msn/msn.h Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/msn/msn.h Fri Apr 17 21:29:18 2009 +0000 @@ -76,6 +76,8 @@ #define BUDDY_ALIAS_MAXLEN 387 +#define MSN_CAM_GUID "4BD96FC0-AB17-4425-A14A-439185962DC8" +#define MSN_CAM_REQUEST_GUID "1C9AA97E-9C05-4583-A3BD-908A196F1E92" #define MSN_FT_GUID "5D3E02AB-6190-11D3-BBBB-00C04F795683" #define MSN_OBJ_GUID "A4268EEC-FEC5-49E5-95C3-F126696BDBF6"
--- a/libpurple/protocols/msn/session.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/msn/session.c Fri Apr 17 21:29:18 2009 +0000 @@ -303,7 +303,7 @@ for (l = remote_user->group_ids; l != NULL; l = l->next) { const char *name = msn_userlist_find_group_name(remote_user->userlist, l->data); - if (name && !g_strcasecmp(group_name, name)) + if (name && !g_ascii_strcasecmp(group_name, name)) { found = TRUE; break;
--- a/libpurple/protocols/msn/slp.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/msn/slp.c Fri Apr 17 21:29:18 2009 +0000 @@ -377,6 +377,50 @@ purple_xfer_request(xfer); } + } else if (!strcmp(euf_guid, MSN_CAM_REQUEST_GUID)) { + purple_debug_info("msn", "Cam request.\n"); + if (slpcall && slpcall->slplink && + slpcall->slplink->session) { + PurpleConversation *conv; + gchar *from = slpcall->slplink->remote_user; + conv = purple_find_conversation_with_account( + PURPLE_CONV_TYPE_IM, from, + slpcall->slplink->session->account); + if (conv) { + char *buf; + buf = g_strdup_printf( + _("%s requests to view your " + "webcam, but this request is " + "not yet supported."), from); + purple_conversation_write(conv, NULL, buf, + PURPLE_MESSAGE_SYSTEM | + PURPLE_MESSAGE_NOTIFY, + time(NULL)); + g_free(buf); + } + } + } else if (!strcmp(euf_guid, MSN_CAM_GUID)) { + purple_debug_info("msn", "Cam invite.\n"); + if (slpcall && slpcall->slplink && + slpcall->slplink->session) { + PurpleConversation *conv; + gchar *from = slpcall->slplink->remote_user; + conv = purple_find_conversation_with_account( + PURPLE_CONV_TYPE_IM, from, + slpcall->slplink->session->account); + if (conv) { + char *buf; + buf = g_strdup_printf( + _("%s has sent you a webcam " + "invite, which is not yet " + "supported."), from); + purple_conversation_write(conv, NULL, buf, + PURPLE_MESSAGE_SYSTEM | + PURPLE_MESSAGE_NOTIFY, + time(NULL)); + g_free(buf); + } + } } else purple_debug_warning("msn", "SLP SessionReq with unknown EUF-GUID: %s\n", euf_guid); }
--- a/libpurple/protocols/msn/slplink.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/msn/slplink.c Fri Apr 17 21:29:18 2009 +0000 @@ -46,7 +46,7 @@ pload = msn_message_gen_payload(msg, &pload_size); if (!purple_util_write_data_to_file_absolute(tmp, pload, pload_size)) { - purple_debug_error("msn", "could not save debug file"); + purple_debug_error("msn", "could not save debug file\n"); } g_free(tmp); } @@ -682,7 +682,9 @@ size = st.st_size; if(!file_name) { - u8 = purple_utf8_try_convert(g_basename(file_path)); + base = g_path_get_basename(file_path); + u8 = purple_utf8_try_convert(base); + g_free(base); file_name = u8; }
--- a/libpurple/protocols/msn/switchboard.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/msn/switchboard.c Fri Apr 17 21:29:18 2009 +0000 @@ -1237,10 +1237,8 @@ msn_emoticon_msg); msn_table_add_msg_type(cbs_table, "text/x-msnmsgr-datacast", msn_datacast_msg); -#if 0 - msn_table_add_msg_type(cbs_table, "text/x-msmmsginvite", + msn_table_add_msg_type(cbs_table, "text/x-msmsgsinvite", msn_invite_msg); -#endif } void
--- a/libpurple/protocols/msn/userlist.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/msn/userlist.c Fri Apr 17 21:29:18 2009 +0000 @@ -448,7 +448,7 @@ g_return_val_if_fail(user->passport != NULL, NULL); - if (!g_strcasecmp(passport, user->passport)){ + if (!g_ascii_strcasecmp(passport, user->passport)){ return user; } } @@ -470,7 +470,7 @@ continue; } - if ( !g_strcasecmp(uid, user->uid) ) { + if ( !g_ascii_strcasecmp(uid, user->uid) ) { return user; } } @@ -492,7 +492,7 @@ continue; } - if (!g_strcasecmp(number, user->phone.mobile)) { + if (!g_ascii_strcasecmp(number, user->phone.mobile)) { return user; } } @@ -524,7 +524,7 @@ { MsnGroup *group = l->data; - if (!g_strcasecmp(group->id,id)) + if (!g_ascii_strcasecmp(group->id,id)) return group; } @@ -543,7 +543,7 @@ { MsnGroup *group = l->data; - if ((group->name != NULL) && !g_strcasecmp(name, group->name)) + if ((group->name != NULL) && !g_ascii_strcasecmp(name, group->name)) return group; } @@ -784,7 +784,7 @@ { user = (MsnUser *)l->data; - if (!g_strcasecmp(who, user->passport)) { + if (!g_ascii_strcasecmp(who, user->passport)) { userlist->pending = g_list_delete_link(userlist->pending, l); break; }
--- a/libpurple/protocols/msnp9/httpconn.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/msnp9/httpconn.c Fri Apr 17 21:29:18 2009 +0000 @@ -703,7 +703,7 @@ httpconn->inpa = purple_input_add(httpconn->fd, PURPLE_INPUT_READ, read_cb, data); - httpconn->timer = purple_timeout_add(2000, msn_httpconn_poll, httpconn); + httpconn->timer = purple_timeout_add_seconds(3, msn_httpconn_poll, httpconn); msn_httpconn_process_queue(httpconn); }
--- a/libpurple/protocols/msnp9/slp.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/msnp9/slp.c Fri Apr 17 21:29:18 2009 +0000 @@ -33,8 +33,8 @@ #include "smiley.h" -/* ms to delay between sending buddy icon requests to the server. */ -#define BUDDY_ICON_DELAY 20000 +/* Seconds to delay between sending buddy icon requests to the server. */ +#define BUDDY_ICON_DELAY 20 static void send_ok(MsnSlpCall *slpcall, const char *branch, const char *type, const char *content); @@ -1058,8 +1058,8 @@ purple_timeout_remove(userlist->buddy_icon_request_timer); } - /* Wait BUDDY_ICON_DELAY ms before freeing our window slot and requesting the next icon. */ - userlist->buddy_icon_request_timer = purple_timeout_add(BUDDY_ICON_DELAY, + /* Wait BUDDY_ICON_DELAY_S seconds before freeing our window slot and requesting the next icon. */ + userlist->buddy_icon_request_timer = purple_timeout_add_seconds(BUDDY_ICON_DELAY, msn_release_buddy_icon_request_timeout, userlist); }
--- a/libpurple/protocols/msnp9/slpcall.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/msnp9/slpcall.c Fri Apr 17 21:29:18 2009 +0000 @@ -68,7 +68,7 @@ msn_slplink_add_slpcall(slplink, slpcall); - slpcall->timer = purple_timeout_add(MSN_SLPCALL_TIMEOUT, msn_slp_call_timeout, slpcall); + slpcall->timer = purple_timeout_add_seconds(MSN_SLPCALL_TIMEOUT, msn_slp_call_timeout, slpcall); return slpcall; }
--- a/libpurple/protocols/msnp9/slpcall.h Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/msnp9/slpcall.h Fri Apr 17 21:29:18 2009 +0000 @@ -33,7 +33,7 @@ #include "slpsession.h" /* The official client seems to timeout slp calls after 5 minutes */ -#define MSN_SLPCALL_TIMEOUT 300000 +#define MSN_SLPCALL_TIMEOUT 300 typedef enum {
--- a/libpurple/protocols/msnp9/transaction.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/msnp9/transaction.c Fri Apr 17 21:29:18 2009 +0000 @@ -211,7 +211,7 @@ purple_timeout_remove(trans->timer); } trans->timeout_cb = cb; - trans->timer = purple_timeout_add(60000, transaction_timeout, trans); + trans->timer = purple_timeout_add_seconds(60, transaction_timeout, trans); } void
--- a/libpurple/protocols/myspace/myspace.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/myspace/myspace.c Fri Apr 17 21:29:18 2009 +0000 @@ -1245,7 +1245,7 @@ /* Disable due to problems with timeouts. TODO: fix. */ #ifdef MSIM_USE_KEEPALIVE - purple_timeout_add(MSIM_KEEPALIVE_INTERVAL_CHECK, + purple_timeout_add_seconds(MSIM_KEEPALIVE_INTERVAL_CHECK, (GSourceFunc)msim_check_alive, session); #endif
--- a/libpurple/protocols/myspace/myspace.h Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/myspace/myspace.h Fri Apr 17 21:29:18 2009 +0000 @@ -114,8 +114,8 @@ #define MSIM_KEEPALIVE_INTERVAL (3 * 60) /*#define MSIM_USE_KEEPALIVE*/ -/* Time to check if alive (milliseconds) */ -#define MSIM_KEEPALIVE_INTERVAL_CHECK (30 * 1000) +/* Time to check if alive (seconds) */ +#define MSIM_KEEPALIVE_INTERVAL_CHECK 30 /* Time to check for new mail (milliseconds) */ #define MSIM_MAIL_INTERVAL_CHECK (60 * 1000)
--- a/libpurple/protocols/oscar/oscar.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/oscar/oscar.c Fri Apr 17 21:29:18 2009 +0000 @@ -1268,7 +1268,7 @@ aim_ssi_reqdata(od); if (od->getblisttimer > 0) purple_timeout_remove(od->getblisttimer); - od->getblisttimer = purple_timeout_add(30000, purple_ssi_rerequestdata, od); + od->getblisttimer = purple_timeout_add_seconds(30, purple_ssi_rerequestdata, od); aim_locate_reqrights(od); aim_buddylist_reqrights(od, conn); @@ -5047,7 +5047,7 @@ _("The AIM servers were temporarily unable to send " "your buddy list. Your buddy list is not lost, and " "will probably become available in a few minutes.")); - od->getblisttimer = purple_timeout_add(30000, purple_ssi_rerequestdata, od); + od->getblisttimer = purple_timeout_add_seconds(30, purple_ssi_rerequestdata, od); return 1; }
--- a/libpurple/protocols/oscar/peer.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/oscar/peer.c Fri Apr 17 21:29:18 2009 +0000 @@ -812,7 +812,7 @@ (conn->client_connect_data != NULL)) { /* Connecting... */ - conn->connect_timeout_timer = purple_timeout_add(5000, + conn->connect_timeout_timer = purple_timeout_add_seconds(5, peer_connection_tooktoolong, conn); return; }
--- a/libpurple/protocols/sametime/sametime.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/sametime/sametime.c Fri Apr 17 21:29:18 2009 +0000 @@ -28,8 +28,6 @@ /* glib includes */ #include <glib.h> -#include <glib/ghash.h> -#include <glib/glist.h> /* purple includes */ #include "internal.h" @@ -810,7 +808,7 @@ static void blist_schedule(struct mwPurplePluginData *pd) { if(pd->save_event) return; - pd->save_event = purple_timeout_add(BLIST_SAVE_SECONDS * 1000, + pd->save_event = purple_timeout_add_seconds(BLIST_SAVE_SECONDS, blist_save_cb, pd); }
--- a/libpurple/protocols/yahoo/yahoo.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/yahoo/yahoo.c Fri Apr 17 21:29:18 2009 +0000 @@ -2829,6 +2829,7 @@ p2p_data->host_username = g_strdup(who); p2p_data->val_13 = val_13; p2p_data->connection_type = YAHOO_P2P_WE_ARE_SERVER; + p2p_data->source = -1; purple_network_listen(YAHOO_PAGER_PORT_P2P, SOCK_STREAM, yahoo_p2p_server_listen_cb, p2p_data); @@ -2932,10 +2933,9 @@ if (base64) { guint32 ip; - char *tmp2; YahooFriend *f; char *host_ip; - struct yahoo_p2p_data *p2p_data = g_new0(struct yahoo_p2p_data, 1); + struct yahoo_p2p_data *p2p_data; decoded = purple_base64_decode(base64, &len); if (len) { @@ -2944,9 +2944,7 @@ g_free(tmp); } - tmp2 = g_strndup((const gchar *)decoded, len); /* so its \0 terminated...*/ - ip = strtol(tmp2, NULL, 10); - g_free(tmp2); + ip = strtol((gchar *)decoded, NULL, 10); g_free(decoded); host_ip = g_strdup_printf("%u.%u.%u.%u", ip & 0xff, (ip >> 8) & 0xff, (ip >> 16) & 0xff, (ip >> 24) & 0xff); @@ -2964,12 +2962,14 @@ val_11 = f->session_id; } - p2p_data->host_username = g_strdup(who); + p2p_data = g_new0(struct yahoo_p2p_data, 1); + p2p_data->host_username = g_strdup(who); p2p_data->val_13 = val_13; p2p_data->session_id = val_11; p2p_data->host_ip = host_ip; p2p_data->gc = gc; p2p_data->connection_type = YAHOO_P2P_WE_ARE_CLIENT; + p2p_data->source = -1; /* connect to host */ if((purple_proxy_connect(NULL, account, host_ip, YAHOO_PAGER_PORT_P2P, yahoo_p2p_init_cb, p2p_data))==NULL) { @@ -4416,7 +4416,7 @@ "Cookie: T=%s; path=/; domain=.yahoo.com; Y=%s; path=/; domain=.yahoo.com;\r\n" "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n" "Host: validate.msg.yahoo.com\r\n" - "Content-Length: %d\r\n" + "Content-Length: %" G_GSIZE_FORMAT "\r\n" "Cache-Control: no-cache\r\n\r\n%s", YAHOO_CLIENT_VERSION, yd->cookie_t, yd->cookie_y, strlen(validate_request_str), validate_request_str);
--- a/libpurple/protocols/yahoo/yahoo_filexfer.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/yahoo/yahoo_filexfer.c Fri Apr 17 21:29:18 2009 +0000 @@ -1029,12 +1029,7 @@ xd->port = YAHOO_XFER_RELAY_PORT; url = g_strdup_printf("%ld.%ld.%ld.%ld", d, c, b, a); - if (!purple_url_parse(url, &(xd->host), &(xd->port), &(xd->path), NULL, NULL)) { - purple_xfer_cancel_remote(xfer); - g_free(url); - return; - } - g_free(url); + /* Free the address... */ g_free(hosts->data); hosts = g_slist_remove(hosts, hosts->data); @@ -1048,6 +1043,13 @@ hosts = g_slist_remove(hosts, hosts->data); } + if (!purple_url_parse(url, &(xd->host), &(xd->port), &(xd->path), NULL, NULL)) { + purple_xfer_cancel_remote(xfer); + g_free(url); + return; + } + g_free(url); + pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, YAHOO_STATUS_AVAILABLE, yd->session_id); filename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); @@ -1385,7 +1387,13 @@ strcpy(time_str + strlen(time_str) - 1, "\0"); if (xd->txbuflen == 0) { - xd->txbuf = g_strdup_printf("HTTP/1.0 200 OK\r\nDate: %s GMT\r\nServer: Y!/1.0\r\nMIME-version: 1.0\r\nLast-modified: %s GMT\r\nContent-length: %d\r\n\r\n", time_str, time_str, xfer->size); + xd->txbuf = g_strdup_printf("HTTP/1.0 200 OK\r\n" + "Date: %s GMT\r\n" + "Server: Y!/1.0\r\n" + "MIME-version: 1.0\r\n" + "Last-modified: %s GMT\r\n" + "Content-length: %" G_GSIZE_FORMAT "\r\n\r\n", + time_str, time_str, xfer->size); xd->txbuflen = strlen(xd->txbuf); xd->txbuf_written = 0; }
--- a/libpurple/protocols/zephyr/ZVariables.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/zephyr/ZVariables.c Fri Apr 17 21:29:18 2009 +0000 @@ -186,7 +186,7 @@ #define max(a,b) ((a > b) ? (a) : (b)) #endif - if (g_strncasecmp(bfr, var, max(strlen(var), cp - bfr))) + if (g_ascii_strncasecmp(bfr, var, max(strlen(var), cp - bfr))) return(0); /* var is not the var in bfr ==> no match */
--- a/libpurple/protocols/zephyr/zephyr.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/protocols/zephyr/zephyr.c Fri Apr 17 21:29:18 2009 +0000 @@ -960,7 +960,7 @@ tc = tree_child(ptree,0)->contents; /* g_strcasecmp() is deprecated. What is the encoding here??? */ - if (ptree->num_children > 0 && tc && !g_strcasecmp(tc, key)) { + if (ptree->num_children > 0 && tc && !g_ascii_strcasecmp(tc, key)) { return ptree; } else { parse_tree *result = &null_parse_tree; @@ -1880,7 +1880,7 @@ } else if (use_tzc(zephyr)) { zephyr->nottimer = purple_timeout_add(100, check_notify_tzc, gc); } - zephyr->loctimer = purple_timeout_add(20000, check_loc, gc); + zephyr->loctimer = purple_timeout_add_seconds(20, check_loc, gc); }
--- a/libpurple/prpl.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/prpl.c Fri Apr 17 21:29:18 2009 +0000 @@ -515,7 +515,7 @@ if (prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, initiate_media)) { /* should check that the protocol supports this media type here? */ - return prpl_info->initiate_media(gc, who, type); + return prpl_info->initiate_media(account, who, type); } else #endif return FALSE; @@ -538,7 +538,7 @@ if (prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_media_caps)) { - return prpl_info->get_media_caps(gc, who); + return prpl_info->get_media_caps(account, who); } #endif return PURPLE_MEDIA_CAPS_NONE;
--- a/libpurple/prpl.h Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/prpl.h Fri Apr 17 21:29:18 2009 +0000 @@ -464,22 +464,22 @@ /** * Initiate a media session with the given contact. * - * @param conn The connection to initiate the media session on. + * @param account The account to initiate the media session on. * @param who The remote user to initiate the session with. * @param type The type of media session to initiate. * @return TRUE if the call succeeded else FALSE. (Doesn't imply the media session or stream will be successfully created) */ - gboolean (*initiate_media)(PurpleConnection *gc, const char *who, + gboolean (*initiate_media)(PurpleAccount *account, const char *who, PurpleMediaSessionType type); /** * Checks to see if the given contact supports the given type of media session. * - * @param conn The connection the contact is on. + * @param account The account the contact is on. * @param who The remote user to check for media capability with. * @return The media caps the contact supports. */ - PurpleMediaCaps (*get_media_caps)(PurpleConnection *gc, + PurpleMediaCaps (*get_media_caps)(PurpleAccount *account, const char *who); };
--- a/libpurple/server.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/server.c Fri Apr 17 21:29:18 2009 +0000 @@ -587,6 +587,11 @@ account = purple_connection_get_account(gc); + /* + * XXX: Should we be setting this here, or relying on prpls to set it? + */ + flags |= PURPLE_MESSAGE_RECV; + if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->set_permit_deny == NULL) { /* protocol does not support privacy, handle it ourselves */ if (!purple_privacy_check(account, who)) { @@ -630,11 +635,6 @@ if (conv == NULL) conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); - /* - * XXX: Should we be setting this here, or relying on prpls to set it? - */ - flags |= PURPLE_MESSAGE_RECV; - if (conv == NULL) conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); @@ -939,6 +939,14 @@ if (!conv) return; + /* Did I send the message? */ + if (purple_strequal(purple_conv_chat_get_nick(chat), who)) { + flags |= PURPLE_MESSAGE_SEND; + flags &= ~PURPLE_MESSAGE_RECV; /* Just in case some prpl sets it! */ + } else { + flags |= PURPLE_MESSAGE_RECV; + } + /* * Make copies of the message and the sender in case plugins want * to free these strings and replace them with a modifed version.
--- a/libpurple/stun.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/stun.c Fri Apr 17 21:29:18 2009 +0000 @@ -341,6 +341,12 @@ } if (!purple_network_listen_range(12108, 12208, SOCK_DGRAM, hbn_listen_cb, hosts)) { + while(hosts) { + hosts = g_slist_remove(hosts, hosts->data); + g_free(hosts->data); + hosts = g_slist_remove(hosts, hosts->data); + } + nattype.status = PURPLE_STUN_STATUS_UNKNOWN; nattype.lookup_time = time(NULL); do_callbacks();
--- a/libpurple/theme-manager.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/theme-manager.c Fri Apr 17 21:29:18 2009 +0000 @@ -130,6 +130,7 @@ theme_dir = g_build_filename(purple_dir, type, NULL); theme = purple_theme_loader_build(loader, theme_dir); + g_free(theme_dir); if (PURPLE_IS_THEME(theme)) purple_theme_manager_add_theme(theme);
--- a/libpurple/win32/win32dep.c Fri Apr 17 21:29:11 2009 +0000 +++ b/libpurple/win32/win32dep.c Fri Apr 17 21:29:18 2009 +0000 @@ -467,7 +467,14 @@ WSACleanup(); g_free(app_data_dir); + g_free(install_dir); + g_free(lib_dir); + g_free(locale_dir); + app_data_dir = NULL; + install_dir = NULL; + lib_dir = NULL; + locale_dir = NULL; libpurpledll_hInstance = NULL; }
--- a/pidgin/eggtrayicon.h Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/eggtrayicon.h Fri Apr 17 21:29:18 2009 +0000 @@ -21,8 +21,7 @@ #ifndef __EGG_TRAY_ICON_H__ #define __EGG_TRAY_ICON_H__ -#include <gtk/gtkplug.h> -#include <gtk/gtkversion.h> +#include <gtk/gtk.h> #include <gdk/gdkx.h> G_BEGIN_DECLS
--- a/pidgin/gtkblist-theme-loader.c Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkblist-theme-loader.c Fri Apr 17 21:29:18 2009 +0000 @@ -21,6 +21,7 @@ */ #include <stdlib.h> +#include <string.h> #include "xmlnode.h" @@ -44,10 +45,10 @@ gchar *filename_full, *data; const gchar *temp; gboolean success = TRUE; - GdkColor *bgcolor, *expanded_bgcolor, *collapsed_bgcolor, *contact_color; + GdkColor bgcolor, expanded_bgcolor, collapsed_bgcolor, contact_color; GdkColor color; - FontColorPair *expanded, *collapsed, *contact, *online, *away, *offline, *idle, *message, *message_nick_said, *status; - PidginBlistLayout *layout; + FontColorPair expanded, collapsed, contact, online, away, offline, idle, message, message_nick_said, status; + PidginBlistLayout layout; PidginBlistTheme *theme; /* Find the theme file */ @@ -63,145 +64,117 @@ sub_node = xmlnode_get_child(root_node, "description"); data = xmlnode_get_data(sub_node); - /* init all structs and colors */ - bgcolor = g_new0(GdkColor, 1); - expanded_bgcolor = g_new0(GdkColor, 1); - collapsed_bgcolor = g_new0(GdkColor, 1); - - layout = g_new0(PidginBlistLayout, 1); - - contact_color = g_new0(GdkColor, 1); - - expanded = g_new0(FontColorPair, 1); - collapsed = g_new0(FontColorPair, 1); - contact = g_new0(FontColorPair, 1); - online = g_new0(FontColorPair, 1); - away = g_new0(FontColorPair, 1); - offline = g_new0(FontColorPair, 1); - idle = g_new0(FontColorPair, 1); - message = g_new0(FontColorPair, 1); - message_nick_said = g_new0(FontColorPair, 1); - status = g_new0(FontColorPair, 1); - /* <blist> */ if ((success = (sub_node = xmlnode_get_child(root_node, "blist")) != NULL)) { - if ((temp = xmlnode_get_attrib(sub_node, "color")) != NULL && gdk_color_parse(temp, bgcolor)) - gdk_colormap_alloc_color(gdk_colormap_get_system(), bgcolor, FALSE, TRUE); - else { - g_free(bgcolor); - bgcolor = NULL; - } + if ((temp = xmlnode_get_attrib(sub_node, "color")) != NULL && gdk_color_parse(temp, &bgcolor)) + gdk_colormap_alloc_color(gdk_colormap_get_system(), &bgcolor, FALSE, TRUE); + else + memset(&bgcolor, 0, sizeof(GdkColor)); } /* <groups> */ if ((success = (success && (sub_node = xmlnode_get_child(root_node, "groups")) != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "expanded")) != NULL))) { - expanded->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); + expanded.font = xmlnode_get_attrib(sub_sub_node, "font"); if ((temp = xmlnode_get_attrib(sub_sub_node, "text_color")) != NULL && gdk_color_parse(temp, &color)) - expanded->color = g_strdup(temp); - else expanded->color = g_strdup(DEFAULT_TEXT_COLOR); + expanded.color = temp; + else expanded.color = DEFAULT_TEXT_COLOR; - if ((temp = xmlnode_get_attrib(sub_sub_node, "background")) != NULL && gdk_color_parse(temp, expanded_bgcolor)) - gdk_colormap_alloc_color(gdk_colormap_get_system(), expanded_bgcolor, FALSE, TRUE); - else { - g_free(expanded_bgcolor); - expanded_bgcolor = NULL; - } + if ((temp = xmlnode_get_attrib(sub_sub_node, "background")) != NULL && gdk_color_parse(temp, &expanded_bgcolor)) + gdk_colormap_alloc_color(gdk_colormap_get_system(), &expanded_bgcolor, FALSE, TRUE); + else + memset(&expanded_bgcolor, 0, sizeof(GdkColor)); } if ((success = (success && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "collapsed")) != NULL))) { - collapsed->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); + collapsed.font = xmlnode_get_attrib(sub_sub_node, "font"); if((temp = xmlnode_get_attrib(sub_sub_node, "text_color")) != NULL && gdk_color_parse(temp, &color)) - collapsed->color = g_strdup(temp); - else collapsed->color = g_strdup(DEFAULT_TEXT_COLOR); + collapsed.color = temp; + else collapsed.color = DEFAULT_TEXT_COLOR; - if ((temp = xmlnode_get_attrib(sub_sub_node, "background")) != NULL && gdk_color_parse(temp, collapsed_bgcolor)) - gdk_colormap_alloc_color(gdk_colormap_get_system(), collapsed_bgcolor, FALSE, TRUE); - else { - g_free(collapsed_bgcolor); - collapsed_bgcolor = NULL; - } + if ((temp = xmlnode_get_attrib(sub_sub_node, "background")) != NULL && gdk_color_parse(temp, &collapsed_bgcolor)) + gdk_colormap_alloc_color(gdk_colormap_get_system(), &collapsed_bgcolor, FALSE, TRUE); + else + memset(&collapsed_bgcolor, 0, sizeof(GdkColor)); } /* <buddys> */ if ((success = (success && (sub_node = xmlnode_get_child(root_node, "buddys")) != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "placement")) != NULL))) { - layout->status_icon = (temp = xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) : 0; - layout->text = (temp = xmlnode_get_attrib(sub_sub_node, "name")) != NULL ? atoi(temp) : 1; - layout->emblem = (temp = xmlnode_get_attrib(sub_sub_node, "emblem")) != NULL ? atoi(temp) : 2; - layout->protocol_icon = (temp = xmlnode_get_attrib(sub_sub_node, "protocol_icon")) != NULL ? atoi(temp) : 3; - layout->buddy_icon = (temp = xmlnode_get_attrib(sub_sub_node, "buddy_icon")) != NULL ? atoi(temp) : 4; - layout->show_status = (temp = xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) != 0 : 1; + layout.status_icon = (temp = xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) : 0; + layout.text = (temp = xmlnode_get_attrib(sub_sub_node, "name")) != NULL ? atoi(temp) : 1; + layout.emblem = (temp = xmlnode_get_attrib(sub_sub_node, "emblem")) != NULL ? atoi(temp) : 2; + layout.protocol_icon = (temp = xmlnode_get_attrib(sub_sub_node, "protocol_icon")) != NULL ? atoi(temp) : 3; + layout.buddy_icon = (temp = xmlnode_get_attrib(sub_sub_node, "buddy_icon")) != NULL ? atoi(temp) : 4; + layout.show_status = (temp = xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) != 0 : 1; } if ((success = (success && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "background")) != NULL))) { - if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color"), contact_color)) - gdk_colormap_alloc_color(gdk_colormap_get_system(), contact_color, FALSE, TRUE); - else { - g_free(contact_color); - contact_color = NULL; - } + if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color"), &contact_color)) + gdk_colormap_alloc_color(gdk_colormap_get_system(), &contact_color, FALSE, TRUE); + else + memset(&contact_color, 0, sizeof(GdkColor)); } if ((success = (success && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "contact_text")) != NULL))) { - contact->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); + contact.font = xmlnode_get_attrib(sub_sub_node, "font"); if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) - contact->color = g_strdup(temp); - else contact->color = g_strdup(DEFAULT_TEXT_COLOR); + contact.color = temp; + else contact.color = DEFAULT_TEXT_COLOR; } if ((success = (success && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "online_text")) != NULL))) { - online->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); + online.font = xmlnode_get_attrib(sub_sub_node, "font"); if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) - online->color = g_strdup(temp); - else online->color = g_strdup(DEFAULT_TEXT_COLOR); + online.color = temp; + else online.color = DEFAULT_TEXT_COLOR; } if ((success = (success && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "away_text")) != NULL))) { - away->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); + away.font = xmlnode_get_attrib(sub_sub_node, "font"); if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) - away->color = g_strdup(temp); - else away->color = g_strdup(DEFAULT_TEXT_COLOR); + away.color = temp; + else away.color = DEFAULT_TEXT_COLOR; } if ((success = (success && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "offline_text")) != NULL))) { - offline->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); + offline.font = xmlnode_get_attrib(sub_sub_node, "font"); if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) - online->color = g_strdup(temp); - else online->color = g_strdup(DEFAULT_TEXT_COLOR); + offline.color = temp; + else offline.color = DEFAULT_TEXT_COLOR; } if ((success = (success && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "idle_text")) != NULL))) { - idle->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); + idle.font = xmlnode_get_attrib(sub_sub_node, "font"); if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) - idle->color = g_strdup(temp); - else online->color = g_strdup(DEFAULT_TEXT_COLOR); + idle.color = temp; + else idle.color = DEFAULT_TEXT_COLOR; } if ((success = (success && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "message_text")) != NULL))) { - message->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); + message.font = xmlnode_get_attrib(sub_sub_node, "font"); if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) - message->color = g_strdup(temp); - else message->color = g_strdup(DEFAULT_TEXT_COLOR); + message.color = temp; + else message.color = DEFAULT_TEXT_COLOR; } if ((success = (success && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "message_nick_said_text")) != NULL))) { - message_nick_said->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); + message_nick_said.font = xmlnode_get_attrib(sub_sub_node, "font"); if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) - message_nick_said->color = g_strdup(temp); - else message_nick_said->color = g_strdup(DEFAULT_TEXT_COLOR); + message_nick_said.color = temp; + else message_nick_said.color = DEFAULT_TEXT_COLOR; } if ((success = (success && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "status_text")) != NULL))) { - status->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); + status.font = xmlnode_get_attrib(sub_sub_node, "font"); if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) - status->color = g_strdup(temp); - else status->color = g_strdup(DEFAULT_TEXT_COLOR); + status.color = temp; + else status.color = DEFAULT_TEXT_COLOR; } /* name is required for theme manager */ @@ -215,21 +188,21 @@ "image", xmlnode_get_attrib(root_node, "image"), "directory", dir, "description", data, - "background-color", bgcolor, - "layout", layout, - "expanded-color", expanded_bgcolor, - "expanded-text", expanded, - "collapsed-color", collapsed_bgcolor, - "collapsed-text", collapsed, - "contact-color", contact_color, - "contact", contact, - "online", online, - "away", away, - "offline", offline, - "idle", idle, - "message", message, - "message_nick_said", message_nick_said, - "status", status, NULL); + "background-color", &bgcolor, + "layout", &layout, + "expanded-color", &expanded_bgcolor, + "expanded-text", &expanded, + "collapsed-color", &collapsed_bgcolor, + "collapsed-text", &collapsed, + "contact-color", &contact_color, + "contact", &contact, + "online", &online, + "away", &away, + "offline", &offline, + "idle", &idle, + "message", &message, + "message_nick_said", &message_nick_said, + "status", &status, NULL); xmlnode_free(root_node); g_free(data);
--- a/pidgin/gtkblist-theme.c Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkblist-theme.c Fri Apr 17 21:29:18 2009 +0000 @@ -96,14 +96,21 @@ free_font_and_color(FontColorPair *pair) { if (pair != NULL) { - if (pair->font) - g_free(pair->font); - if (pair->color) - g_free(pair->color); + g_free((gchar *)pair->font); + g_free((gchar *)pair->color); g_free(pair); } } +static FontColorPair * +copy_font_and_color(const FontColorPair *pair) +{ + FontColorPair *copy = g_new0(FontColorPair, 1); + copy->font = g_strdup(pair->font); + copy->color = g_strdup(pair->color); + return copy; +} + /****************************************************************************** * GObject Stuff *****************************************************************************/ @@ -245,17 +252,22 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(obj); /* Buddy List */ + gdk_color_free(priv->bgcolor); g_free(priv->layout); /* Group */ + gdk_color_free(priv->expanded_color); free_font_and_color(priv->expanded); + gdk_color_free(priv->collapsed_color); free_font_and_color(priv->collapsed); /* Buddy */ + gdk_color_free(priv->contact_color); free_font_and_color(priv->contact); free_font_and_color(priv->online); free_font_and_color(priv->away); free_font_and_color(priv->offline); + free_font_and_color(priv->idle); free_font_and_color(priv->message); free_font_and_color(priv->message_nick_said); free_font_and_color(priv->status); @@ -581,7 +593,7 @@ /* Set Methods */ void -pidgin_blist_theme_set_background_color(PidginBlistTheme *theme, GdkColor *color) +pidgin_blist_theme_set_background_color(PidginBlistTheme *theme, const GdkColor *color) { PidginBlistThemePrivate *priv; @@ -589,7 +601,8 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); - priv->bgcolor = color; + gdk_color_free(priv->bgcolor); + priv->bgcolor = gdk_color_copy(color); } void @@ -605,7 +618,7 @@ } void -pidgin_blist_theme_set_layout(PidginBlistTheme *theme, PidginBlistLayout *layout) +pidgin_blist_theme_set_layout(PidginBlistTheme *theme, const PidginBlistLayout *layout) { PidginBlistThemePrivate *priv; @@ -614,11 +627,11 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); g_free(priv->layout); - priv->layout = layout; + priv->layout = g_memdup(layout, sizeof(PidginBlistLayout)); } void -pidgin_blist_theme_set_expanded_background_color(PidginBlistTheme *theme, GdkColor *color) +pidgin_blist_theme_set_expanded_background_color(PidginBlistTheme *theme, const GdkColor *color) { PidginBlistThemePrivate *priv; @@ -626,11 +639,12 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); - priv->expanded_color = color; + gdk_color_free(priv->expanded_color); + priv->expanded_color = gdk_color_copy(color); } void -pidgin_blist_theme_set_expanded_text_info(PidginBlistTheme *theme, FontColorPair *pair) +pidgin_blist_theme_set_expanded_text_info(PidginBlistTheme *theme, const FontColorPair *pair) { PidginBlistThemePrivate *priv; @@ -639,11 +653,11 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); free_font_and_color(priv->expanded); - priv->expanded = pair; + priv->expanded = copy_font_and_color(pair); } void -pidgin_blist_theme_set_collapsed_background_color(PidginBlistTheme *theme, GdkColor *color) +pidgin_blist_theme_set_collapsed_background_color(PidginBlistTheme *theme, const GdkColor *color) { PidginBlistThemePrivate *priv; @@ -651,11 +665,12 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); - priv->collapsed_color = color; + gdk_color_free(priv->collapsed_color); + priv->collapsed_color = gdk_color_copy(color); } void -pidgin_blist_theme_set_collapsed_text_info(PidginBlistTheme *theme, FontColorPair *pair) +pidgin_blist_theme_set_collapsed_text_info(PidginBlistTheme *theme, const FontColorPair *pair) { PidginBlistThemePrivate *priv; @@ -664,11 +679,11 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); free_font_and_color(priv->collapsed); - priv->collapsed = pair; + priv->collapsed = copy_font_and_color(pair); } void -pidgin_blist_theme_set_contact_color(PidginBlistTheme *theme, GdkColor *color) +pidgin_blist_theme_set_contact_color(PidginBlistTheme *theme, const GdkColor *color) { PidginBlistThemePrivate *priv; @@ -676,11 +691,12 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); - priv->contact_color = color; + gdk_color_free(priv->contact_color); + priv->contact_color = gdk_color_copy(color); } void -pidgin_blist_theme_set_contact_text_info(PidginBlistTheme *theme, FontColorPair *pair) +pidgin_blist_theme_set_contact_text_info(PidginBlistTheme *theme, const FontColorPair *pair) { PidginBlistThemePrivate *priv; @@ -689,11 +705,11 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); free_font_and_color(priv->contact); - priv->contact = pair; + priv->contact = copy_font_and_color(pair); } void -pidgin_blist_theme_set_online_text_info(PidginBlistTheme *theme, FontColorPair *pair) +pidgin_blist_theme_set_online_text_info(PidginBlistTheme *theme, const FontColorPair *pair) { PidginBlistThemePrivate *priv; @@ -702,11 +718,11 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); free_font_and_color(priv->online); - priv->online = pair; + priv->online = copy_font_and_color(pair); } void -pidgin_blist_theme_set_away_text_info(PidginBlistTheme *theme, FontColorPair *pair) +pidgin_blist_theme_set_away_text_info(PidginBlistTheme *theme, const FontColorPair *pair) { PidginBlistThemePrivate *priv; @@ -715,11 +731,11 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); free_font_and_color(priv->away); - priv->away = pair; + priv->away = copy_font_and_color(pair); } void -pidgin_blist_theme_set_offline_text_info(PidginBlistTheme *theme, FontColorPair *pair) +pidgin_blist_theme_set_offline_text_info(PidginBlistTheme *theme, const FontColorPair *pair) { PidginBlistThemePrivate *priv; @@ -728,11 +744,11 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); free_font_and_color(priv->offline); - priv->offline = pair; + priv->offline = copy_font_and_color(pair); } void -pidgin_blist_theme_set_idle_text_info(PidginBlistTheme *theme, FontColorPair *pair) +pidgin_blist_theme_set_idle_text_info(PidginBlistTheme *theme, const FontColorPair *pair) { PidginBlistThemePrivate *priv; @@ -741,11 +757,11 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); free_font_and_color(priv->idle); - priv->idle = pair; + priv->idle = copy_font_and_color(pair); } void -pidgin_blist_theme_set_unread_message_text_info(PidginBlistTheme *theme, FontColorPair *pair) +pidgin_blist_theme_set_unread_message_text_info(PidginBlistTheme *theme, const FontColorPair *pair) { PidginBlistThemePrivate *priv; @@ -754,11 +770,11 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); free_font_and_color(priv->message); - priv->message = pair; + priv->message = copy_font_and_color(pair); } void -pidgin_blist_theme_set_unread_message_nick_said_text_info(PidginBlistTheme *theme, FontColorPair *pair) +pidgin_blist_theme_set_unread_message_nick_said_text_info(PidginBlistTheme *theme, const FontColorPair *pair) { PidginBlistThemePrivate *priv; @@ -767,11 +783,11 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); free_font_and_color(priv->message_nick_said); - priv->message_nick_said = pair; + priv->message_nick_said = copy_font_and_color(pair); } void -pidgin_blist_theme_set_status_text_info(PidginBlistTheme *theme, FontColorPair *pair) +pidgin_blist_theme_set_status_text_info(PidginBlistTheme *theme, const FontColorPair *pair) { PidginBlistThemePrivate *priv; @@ -780,5 +796,5 @@ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme)); free_font_and_color(priv->status); - priv->status = pair; + priv->status = copy_font_and_color(pair); }
--- a/pidgin/gtkblist-theme.h Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkblist-theme.h Fri Apr 17 21:29:18 2009 +0000 @@ -61,8 +61,8 @@ typedef struct { - gchar *font; - gchar *color; + const gchar *font; + const gchar *color; } FontColorPair; @@ -220,7 +220,7 @@ * * @param color The new background color. */ -void pidgin_blist_theme_set_background_color(PidginBlistTheme *theme, GdkColor *color); +void pidgin_blist_theme_set_background_color(PidginBlistTheme *theme, const GdkColor *color); /** * Sets the opacity to be used for this buddy list theme. @@ -234,84 +234,84 @@ * * @param layout The new layout. */ -void pidgin_blist_theme_set_layout(PidginBlistTheme *theme, PidginBlistLayout *layout); +void pidgin_blist_theme_set_layout(PidginBlistTheme *theme, const PidginBlistLayout *layout); /** * Sets the background color to be used for expanded groups. * * @param color The new background color. */ -void pidgin_blist_theme_set_expanded_background_color(PidginBlistTheme *theme, GdkColor *color); +void pidgin_blist_theme_set_expanded_background_color(PidginBlistTheme *theme, const GdkColor *color); /** * Sets the text color and font to be used for expanded groups. * * @param pair The new text font at color pair. */ -void pidgin_blist_theme_set_expanded_text_info(PidginBlistTheme *theme, FontColorPair *pair); +void pidgin_blist_theme_set_expanded_text_info(PidginBlistTheme *theme, const FontColorPair *pair); /** * Sets the background color to be used for collapsed groups. * * @param color The new background color. */ -void pidgin_blist_theme_set_collapsed_background_color(PidginBlistTheme *theme, GdkColor *color); +void pidgin_blist_theme_set_collapsed_background_color(PidginBlistTheme *theme, const GdkColor *color); /** * Sets the text color and font to be used for expanded groups. * * @param pair The new text font at color pair. */ -void pidgin_blist_theme_set_collapsed_text_info(PidginBlistTheme *theme, FontColorPair *pair); +void pidgin_blist_theme_set_collapsed_text_info(PidginBlistTheme *theme, const FontColorPair *pair); /** * Sets the background color to be used for contacts and chats. * * @param color The color to use for contacts and chats. */ -void pidgin_blist_theme_set_contact_color(PidginBlistTheme *theme, GdkColor *color); +void pidgin_blist_theme_set_contact_color(PidginBlistTheme *theme, const GdkColor *color); /** * Sets the text color and font to be used for expanded contacts. * * @param pair The new text font at color pair. */ -void pidgin_blist_theme_set_contact_text_info(PidginBlistTheme *theme, FontColorPair *pair); +void pidgin_blist_theme_set_contact_text_info(PidginBlistTheme *theme, const FontColorPair *pair); /** * Sets the text color and font to be used for online buddies. * * @param pair The new text font at color pair. */ -void pidgin_blist_theme_set_online_text_info(PidginBlistTheme *theme, FontColorPair *pair); +void pidgin_blist_theme_set_online_text_info(PidginBlistTheme *theme, const FontColorPair *pair); /** * Sets the text color and font to be used for away and idle buddies. * * @param pair The new text font at color pair. */ -void pidgin_blist_theme_set_away_text_info(PidginBlistTheme *theme, FontColorPair *pair); +void pidgin_blist_theme_set_away_text_info(PidginBlistTheme *theme, const FontColorPair *pair); /** * Sets the text color and font to be used for offline buddies. * * @param pair The new text font at color pair. */ -void pidgin_blist_theme_set_offline_text_info(PidginBlistTheme *theme, FontColorPair *pair); +void pidgin_blist_theme_set_offline_text_info(PidginBlistTheme *theme, const FontColorPair *pair); /** * Sets the text color and font to be used for idle buddies. * * @param pair The new text font at color pair. */ -void pidgin_blist_theme_set_idle_text_info(PidginBlistTheme *theme, FontColorPair *pair); +void pidgin_blist_theme_set_idle_text_info(PidginBlistTheme *theme, const FontColorPair *pair); /** * Sets the text color and font to be used for buddies with unread messages. * * @param pair The new text font at color pair. */ -void pidgin_blist_theme_set_unread_message_text_info(PidginBlistTheme *theme, FontColorPair *pair); +void pidgin_blist_theme_set_unread_message_text_info(PidginBlistTheme *theme, const FontColorPair *pair); /** * Sets the text color and font to be used for a chat with unread messages @@ -319,14 +319,14 @@ * * @param pair The new text font at color pair. */ -void pidgin_blist_theme_set_unread_message_nick_said_text_info(PidginBlistTheme *theme, FontColorPair *pair); +void pidgin_blist_theme_set_unread_message_nick_said_text_info(PidginBlistTheme *theme, const FontColorPair *pair); /** * Sets the text color and font to be used for buddy status messages. * * @param pair The new text font at color pair. */ -void pidgin_blist_theme_set_status_text_info(PidginBlistTheme *theme, FontColorPair *pair); +void pidgin_blist_theme_set_status_text_info(PidginBlistTheme *theme, const FontColorPair *pair); G_END_DECLS #endif /* PIDGIN_BLIST_THEME_H */
--- a/pidgin/gtkblist.c Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkblist.c Fri Apr 17 21:29:18 2009 +0000 @@ -5505,6 +5505,7 @@ GtkWidget *sep; GtkWidget *label; char *pretty, *tmp; + const char *theme_name; GtkAccelGroup *accel_group; GtkTreeSelection *selection; GtkTargetEntry dte[] = {{"PURPLE_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW}, @@ -5523,7 +5524,11 @@ gtkblist = PIDGIN_BLIST(list); priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist); - priv->current_theme = PIDGIN_BLIST_THEME(purple_theme_manager_find_theme(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme"), "blist")); + theme_name = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme"); + if (theme_name && *theme_name) + priv->current_theme = PIDGIN_BLIST_THEME(purple_theme_manager_find_theme(theme_name, "blist")); + else + priv->current_theme = NULL; gtkblist->empty_avatar = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 32, 32); gdk_pixbuf_fill(gtkblist->empty_avatar, 0x00000000); @@ -5790,7 +5795,7 @@ purple_blist_set_visible(purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/list_visible")); /* start the refresh timer */ - gtkblist->refresh_timer = g_timeout_add(30000, (GSourceFunc)pidgin_blist_refresh_timer, list); + gtkblist->refresh_timer = purple_timeout_add_seconds(30, (GSourceFunc)pidgin_blist_refresh_timer, list); handle = pidgin_blist_get_handle(); @@ -5911,7 +5916,7 @@ blist = purple_get_blist(); gtkblist = PIDGIN_BLIST(purple_get_blist()); - gtkblist->refresh_timer = g_timeout_add(30000,(GSourceFunc)pidgin_blist_refresh_timer, blist); + gtkblist->refresh_timer = purple_timeout_add_seconds(30,(GSourceFunc)pidgin_blist_refresh_timer, blist); } static gboolean get_iter_from_node(PurpleBlistNode *node, GtkTreeIter *iter) { @@ -6192,7 +6197,7 @@ PurpleBlistNode *selected_node = NULL; GtkTreeIter iter; FontColorPair *pair; - gchar *text_color, *text_font; + gchar const *text_color, *text_font; PidginBlistTheme *theme; group = (PurpleGroup*)gnode; @@ -6632,7 +6637,7 @@ pidgin_blist_tooltip_destroy(); if (gtkblist->refresh_timer) - g_source_remove(gtkblist->refresh_timer); + purple_timeout_remove(gtkblist->refresh_timer); if (gtkblist->timeout) g_source_remove(gtkblist->timeout); if (gtkblist->drag_timeout) @@ -7447,7 +7452,7 @@ if(gtknode->recent_signonoff_timer > 0) purple_timeout_remove(gtknode->recent_signonoff_timer); - gtknode->recent_signonoff_timer = purple_timeout_add(10000, + gtknode->recent_signonoff_timer = purple_timeout_add_seconds(10, (GSourceFunc)buddy_signonoff_timeout_cb, buddy); }
--- a/pidgin/gtkcellrendererexpander.c Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkcellrendererexpander.c Fri Apr 17 21:29:18 2009 +0000 @@ -30,7 +30,6 @@ */ #include <gtk/gtk.h> -#include <gtk/gtktreeview.h> #include "gtkcellrendererexpander.h" static void pidgin_cell_renderer_expander_get_property (GObject *object,
--- a/pidgin/gtkcellrendererexpander.h Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkcellrendererexpander.h Fri Apr 17 21:29:18 2009 +0000 @@ -21,7 +21,7 @@ #ifndef _PIDGINCELLRENDEREREXPANDER_H_ #define _PIDGINCELLRENDEREREXPANDER_H_ -#include <gtk/gtkcellrenderer.h> +#include <gtk/gtk.h> #ifdef __cplusplus extern "C" {
--- a/pidgin/gtkcellrendererprogress.h Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkcellrendererprogress.h Fri Apr 17 21:29:18 2009 +0000 @@ -21,7 +21,7 @@ #ifndef _PIDGINCELLRENDERERPROGRESS_H_ #define _PIDGINCELLRENDERERPROGRESS_H_ -#include <gtk/gtkcellrenderer.h> +#include <gtk/gtk.h> #ifdef __cplusplus extern "C" {
--- a/pidgin/gtkconv.c Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkconv.c Fri Apr 17 21:29:18 2009 +0000 @@ -4981,11 +4981,17 @@ PurpleConversation *conv = gtkconv->active_conv; PidginWindow *win = gtkconv->win; PurpleConversation *c; + PurpleAccount *convaccount = purple_conversation_get_account(conv); + PurpleConnection *gc = purple_account_get_connection(convaccount); + PurplePluginProtocolInfo *prpl_info = gc ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL; + if (sd->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) { PurpleBlistNode *n = NULL; PurpleBuddy *b; PidginConversation *gtkconv = NULL; + PurpleAccount *buddyaccount; + const char *buddyname; n = *(PurpleBlistNode **)sd->data; @@ -4996,32 +5002,44 @@ else return; + buddyaccount = purple_buddy_get_account(b); + buddyname = purple_buddy_get_name(b); /* - * If we already have an open conversation with this buddy, then - * just move the conv to this window. Otherwise, create a new - * conv and add it to this window. + * If a buddy is dragged to a chat window of the same protocol, + * invite him to the chat. */ - c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, b->name, b->account); - if (c != NULL) { - PidginWindow *oldwin; - gtkconv = PIDGIN_CONVERSATION(c); - oldwin = gtkconv->win; - if (oldwin != win) { - pidgin_conv_window_remove_gtkconv(oldwin, gtkconv); - pidgin_conv_window_add_gtkconv(win, gtkconv); - } + if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT && + prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, chat_invite) && + strcmp(purple_account_get_protocol_id(convaccount), + purple_account_get_protocol_id(buddyaccount)) == 0) { + purple_conv_chat_invite_user(PURPLE_CONV_CHAT(conv), buddyname, NULL, TRUE); } else { - c = purple_conversation_new(PURPLE_CONV_TYPE_IM, b->account, b->name); - gtkconv = PIDGIN_CONVERSATION(c); - if (gtkconv->win != win) - { - pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv); - pidgin_conv_window_add_gtkconv(win, gtkconv); + /* + * If we already have an open conversation with this buddy, then + * just move the conv to this window. Otherwise, create a new + * conv and add it to this window. + */ + c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddyname, buddyaccount); + if (c != NULL) { + PidginWindow *oldwin; + gtkconv = PIDGIN_CONVERSATION(c); + oldwin = gtkconv->win; + if (oldwin != win) { + pidgin_conv_window_remove_gtkconv(oldwin, gtkconv); + pidgin_conv_window_add_gtkconv(win, gtkconv); + } + } else { + c = purple_conversation_new(PURPLE_CONV_TYPE_IM, buddyaccount, buddyname); + gtkconv = PIDGIN_CONVERSATION(c); + if (gtkconv->win != win) { + pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv); + pidgin_conv_window_add_gtkconv(win, gtkconv); + } } - } - - /* Make this conversation the active conversation */ - pidgin_conv_window_switch_gtkconv(win, gtkconv); + + /* Make this conversation the active conversation */ + pidgin_conv_window_switch_gtkconv(win, gtkconv); + } gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); } @@ -5040,15 +5058,22 @@ purple_notify_error(win, NULL, _("You are not currently signed on with an account that " "can add that buddy."), NULL); - } - else - { - c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, username); - gtkconv = PIDGIN_CONVERSATION(c); - if (gtkconv->win != win) - { - pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv); - pidgin_conv_window_add_gtkconv(win, gtkconv); + } else { + /* + * If a buddy is dragged to a chat window of the same protocol, + * invite him to the chat. + */ + if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT && + prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, chat_invite) && + strcmp(purple_account_get_protocol_id(convaccount), protocol) == 0) { + purple_conv_chat_invite_user(PURPLE_CONV_CHAT(conv), username, NULL, TRUE); + } else { + c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, username); + gtkconv = PIDGIN_CONVERSATION(c); + if (gtkconv->win != win) { + pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv); + pidgin_conv_window_add_gtkconv(win, gtkconv); + } } } } @@ -5060,7 +5085,7 @@ } else if (sd->target == gdk_atom_intern("text/uri-list", FALSE)) { if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) - pidgin_dnd_file_manage(sd, purple_conversation_get_account(conv), purple_conversation_get_name(conv)); + pidgin_dnd_file_manage(sd, convaccount, purple_conversation_get_name(conv)); gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); } else @@ -6801,7 +6826,8 @@ wrote_msg_update_unseen_cb(PurpleAccount *account, const char *who, const char *message, PurpleConversation *conv, PurpleMessageFlags flags, gpointer null) { - if (conv == NULL || PIDGIN_IS_PIDGIN_CONVERSATION(conv)) + PidginConversation *gtkconv = conv ? PIDGIN_CONVERSATION(conv) : NULL; + if (conv == NULL || (gtkconv && gtkconv->win != hidden_convwin)) return; if (flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)) { PidginUnseenState unseen = PIDGIN_UNSEEN_NONE; @@ -7514,7 +7540,7 @@ } /* In case a conversation is started after the buddy has signed-on/off */ - g_timeout_add(11000, (GSourceFunc)update_buddy_status_timeout, buddy); + purple_timeout_add_seconds(11, (GSourceFunc)update_buddy_status_timeout, buddy); } static void
--- a/pidgin/gtkdebug.c Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkdebug.c Fri Apr 17 21:29:18 2009 +0000 @@ -94,7 +94,7 @@ if(debug_win->timer != 0) { const gchar *text; - g_source_remove(debug_win->timer); + purple_timeout_remove(debug_win->timer); text = gtk_entry_get_text(GTK_ENTRY(debug_win->expression)); purple_prefs_set_string(PIDGIN_PREFS_ROOT "/debug/regex", text); @@ -552,7 +552,7 @@ } if(win->timer == 0) - win->timer = purple_timeout_add(5000, (GSourceFunc)regex_timer_cb, win); + win->timer = purple_timeout_add_seconds(5, (GSourceFunc)regex_timer_cb, win); regex_compile(win); }
--- a/pidgin/gtkdnd-hints.h Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkdnd-hints.h Fri Apr 17 21:29:18 2009 +0000 @@ -25,7 +25,7 @@ #define _PIDGIN_DND_HINTS_H_ #include <glib.h> -#include <gtk/gtkwidget.h> +#include <gtk/gtk.h> /** * Conversation drag-and-drop arrow types.
--- a/pidgin/gtkimhtml.c Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkimhtml.c Fri Apr 17 21:29:18 2009 +0000 @@ -45,7 +45,7 @@ #include "gtksourceundomanager.h" #include "gtksourceview-marshal.h" #include <gtk/gtk.h> -#include <glib/gerror.h> +#include <glib.h> #include <gdk/gdkkeysyms.h> #include <string.h> #include <ctype.h>
--- a/pidgin/gtkimhtml.h Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkimhtml.h Fri Apr 17 21:29:18 2009 +0000 @@ -26,9 +26,7 @@ #define _PIDGINIMHTML_H_ #include <gdk/gdk.h> -#include <gtk/gtktextview.h> -#include <gtk/gtktooltips.h> -#include <gtk/gtkimage.h> +#include <gtk/gtk.h> #include "gtksourceundomanager.h" #include "connection.h"
--- a/pidgin/gtkimhtmltoolbar.h Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkimhtmltoolbar.h Fri Apr 17 21:29:18 2009 +0000 @@ -23,7 +23,7 @@ #ifndef _PIDGINIMHTMLTOOLBAR_H_ #define _PIDGINIMHTMLTOOLBAR_H_ -#include <gtk/gtkvbox.h> +#include <gtk/gtk.h> #include "gtkimhtml.h" #ifdef __cplusplus
--- a/pidgin/gtkmain.c Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkmain.c Fri Apr 17 21:29:18 2009 +0000 @@ -787,7 +787,7 @@ DBusMessage *message = dbus_message_new_method_call(DBUS_SERVICE_PURPLE, DBUS_PATH_PURPLE, DBUS_INTERFACE_PURPLE, "PurpleBlistSetVisible"); gboolean tr = TRUE; - dbus_message_append_args(message, DBUS_TYPE_UINT32, &tr, DBUS_TYPE_INVALID); + dbus_message_append_args(message, DBUS_TYPE_INT32, &tr, DBUS_TYPE_INVALID); dbus_connection_send_with_reply_and_block(conn, message, -1, NULL); dbus_message_unref(message); #endif
--- a/pidgin/gtkmedia.c Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkmedia.c Fri Apr 17 21:29:18 2009 +0000 @@ -97,7 +97,6 @@ GtkWidget *recv_widget; GtkWidget *local_video; GtkWidget *remote_video; - PurpleConnection *pc; guint timeout_id; PurpleMediaSessionType request_type; @@ -432,7 +431,7 @@ { PurpleConversation *conv = purple_find_conversation_with_account( PURPLE_CONV_TYPE_ANY, gtkmedia->priv->screenname, - purple_connection_get_account(gtkmedia->priv->pc)); + purple_media_get_account(gtkmedia->priv->media)); if (conv != NULL) purple_conversation_write(conv, NULL, msg, PURPLE_MESSAGE_SYSTEM, time(NULL)); @@ -476,7 +475,7 @@ { PurpleConversation *conv = purple_find_conversation_with_account( PURPLE_CONV_TYPE_ANY, gtkmedia->priv->screenname, - purple_connection_get_account(gtkmedia->priv->pc)); + purple_media_get_account(gtkmedia->priv->media)); if (conv != NULL) purple_conversation_write(conv, NULL, error, PURPLE_MESSAGE_ERROR, time(NULL)); @@ -495,25 +494,6 @@ gtk_widget_show(GTK_WIDGET(gtkmedia)); } -static gboolean -plug_delete_event_cb(GtkWidget *widget, gpointer data) -{ - return TRUE; -} - -static gboolean -plug_removed_cb(GtkWidget *widget, gpointer data) -{ - return TRUE; -} - -static void -socket_realize_cb(GtkWidget *widget, gpointer data) -{ - gtk_socket_add_id(GTK_SOCKET(widget), - gtk_plug_get_id(GTK_PLUG(data))); -} - static void pidgin_media_accept_cb(PurpleMedia *media, int index) { @@ -531,15 +511,14 @@ static gboolean pidgin_request_timeout_cb(PidginMedia *gtkmedia) { - PurpleConnection *pc; + PurpleAccount *account; PurpleBuddy *buddy; const gchar *alias; PurpleMediaSessionType type; gchar *message = NULL; - pc = purple_media_get_connection(gtkmedia->priv->media); - buddy = purple_find_buddy(purple_connection_get_account(pc), - gtkmedia->priv->screenname); + account = purple_media_get_account(gtkmedia->priv->media); + buddy = purple_find_buddy(account, gtkmedia->priv->screenname); alias = buddy ? purple_buddy_get_contact_alias(buddy) : gtkmedia->priv->screenname; type = gtkmedia->priv->request_type; @@ -560,7 +539,7 @@ purple_request_accept_cancel(gtkmedia, "Media invitation", message, NULL, PURPLE_DEFAULT_ACTION_NONE, - (void*)pc, gtkmedia->priv->screenname, NULL, + (void*)account, gtkmedia->priv->screenname, NULL, gtkmedia->priv->media, pidgin_media_accept_cb, pidgin_media_reject_cb); @@ -570,21 +549,97 @@ } static void +#if GTK_CHECK_VERSION(2,12,0) +pidgin_media_input_volume_changed(GtkScaleButton *range, double value, + PurpleMedia *media) +{ + double val = (double)value * 100.0; +#else pidgin_media_input_volume_changed(GtkRange *range, PurpleMedia *media) { double val = (double)gtk_range_get_value(GTK_RANGE(range)); +#endif purple_prefs_set_int("/pidgin/media/audio/volume/input", val); - val /= 10.0; - purple_media_set_input_volume(media, NULL, val); + purple_media_set_input_volume(media, NULL, val / 10.0); } static void +#if GTK_CHECK_VERSION(2,12,0) +pidgin_media_output_volume_changed(GtkScaleButton *range, double value, + PurpleMedia *media) +{ + double val = (double)value * 100.0; +#else pidgin_media_output_volume_changed(GtkRange *range, PurpleMedia *media) { double val = (double)gtk_range_get_value(GTK_RANGE(range)); +#endif purple_prefs_set_int("/pidgin/media/audio/volume/output", val); - val /= 10.0; - purple_media_set_output_volume(media, NULL, NULL, val); + purple_media_set_output_volume(media, NULL, NULL, val / 10.0); +} + +static GtkWidget * +pidgin_media_add_audio_widget(PidginMedia *gtkmedia, + PurpleMediaSessionType type) +{ + GtkWidget *volume_widget, *progress_parent, *volume, *progress; + double value; + + if (type & PURPLE_MEDIA_SEND_AUDIO) { + value = purple_prefs_get_int( + "/pidgin/media/audio/volume/input"); + } else if (type & PURPLE_MEDIA_RECV_AUDIO) { + value = purple_prefs_get_int( + "/pidgin/media/audio/volume/output"); + } else + g_return_val_if_reached(NULL); + +#if GTK_CHECK_VERSION(2,12,0) + /* Setup widget structure */ + volume_widget = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + progress_parent = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(volume_widget), + progress_parent, TRUE, TRUE, 0); + + /* Volume button */ + volume = gtk_volume_button_new(); + gtk_scale_button_set_value(GTK_SCALE_BUTTON(volume), value/100.0); + gtk_box_pack_end(GTK_BOX(volume_widget), + volume, FALSE, FALSE, 0); +#else + /* Setup widget structure */ + volume_widget = gtk_vbox_new(FALSE, 0); + progress_parent = volume_widget; + + /* Volume slider */ + volume = gtk_hscale_new_with_range(0.0, 100.0, 5.0); + gtk_range_set_increments(GTK_RANGE(volume), 5.0, 25.0); + gtk_range_set_value(GTK_RANGE(volume), value); + gtk_scale_set_draw_value(GTK_SCALE(volume), FALSE); + gtk_box_pack_end(GTK_BOX(volume_widget), + volume, TRUE, FALSE, 0); +#endif + + /* Volume level indicator */ + progress = gtk_progress_bar_new(); + gtk_widget_set_size_request(progress, 250, 10); + gtk_box_pack_end(GTK_BOX(progress_parent), progress, TRUE, FALSE, 0); + + if (type & PURPLE_MEDIA_SEND_AUDIO) { + g_signal_connect (G_OBJECT(volume), "value-changed", + G_CALLBACK(pidgin_media_input_volume_changed), + gtkmedia->priv->media); + gtkmedia->priv->send_progress = progress; + } else if (type & PURPLE_MEDIA_RECV_AUDIO) { + g_signal_connect (G_OBJECT(volume), "value-changed", + G_CALLBACK(pidgin_media_output_volume_changed), + gtkmedia->priv->media); + gtkmedia->priv->recv_progress = progress; + } + + gtk_widget_show_all(volume_widget); + + return volume_widget; } static void @@ -619,27 +674,12 @@ PidginMediaRealizeData *data; GtkWidget *aspect; GtkWidget *remote_video; - GtkWidget *plug; - GtkWidget *socket; GdkColor color = {0, 0, 0, 0}; aspect = gtk_aspect_frame_new(NULL, 0.5, 0.5, 4.0/3.0, FALSE); gtk_frame_set_shadow_type(GTK_FRAME(aspect), GTK_SHADOW_IN); gtk_box_pack_start(GTK_BOX(recv_widget), aspect, TRUE, TRUE, 0); - plug = gtk_plug_new(0); - g_signal_connect(G_OBJECT(plug), "delete-event", - G_CALLBACK(plug_delete_event_cb), plug); - gtk_widget_show(plug); - - socket = gtk_socket_new(); - g_signal_connect(G_OBJECT(socket), "realize", - G_CALLBACK(socket_realize_cb), plug); - g_signal_connect(G_OBJECT(socket), "plug-removed", - G_CALLBACK(plug_removed_cb), NULL); - gtk_container_add(GTK_CONTAINER(aspect), socket); - gtk_widget_show(socket); - data = g_new0(PidginMediaRealizeData, 1); data->gtkmedia = gtkmedia; data->session_id = g_strdup(sid); @@ -649,7 +689,7 @@ gtk_widget_modify_bg(remote_video, GTK_STATE_NORMAL, &color); g_signal_connect(G_OBJECT(remote_video), "realize", G_CALLBACK(realize_cb), data); - gtk_container_add(GTK_CONTAINER(plug), remote_video); + gtk_container_add(GTK_CONTAINER(aspect), remote_video); gtk_widget_set_size_request (GTK_WIDGET(remote_video), 320, 240); gtk_widget_show(remote_video); gtk_widget_show(aspect); @@ -660,27 +700,12 @@ PidginMediaRealizeData *data; GtkWidget *aspect; GtkWidget *local_video; - GtkWidget *plug; - GtkWidget *socket; GdkColor color = {0, 0, 0, 0}; aspect = gtk_aspect_frame_new(NULL, 0.5, 0.5, 4.0/3.0, FALSE); gtk_frame_set_shadow_type(GTK_FRAME(aspect), GTK_SHADOW_IN); gtk_box_pack_start(GTK_BOX(send_widget), aspect, TRUE, TRUE, 0); - plug = gtk_plug_new(0); - g_signal_connect(G_OBJECT(plug), "delete-event", - G_CALLBACK(plug_delete_event_cb), plug); - gtk_widget_show(plug); - - socket = gtk_socket_new(); - g_signal_connect(G_OBJECT(socket), "realize", - G_CALLBACK(socket_realize_cb), plug); - g_signal_connect(G_OBJECT(socket), "plug-removed", - G_CALLBACK(plug_removed_cb), NULL); - gtk_container_add(GTK_CONTAINER(aspect), socket); - gtk_widget_show(socket); - data = g_new0(PidginMediaRealizeData, 1); data->gtkmedia = gtkmedia; data->session_id = g_strdup(sid); @@ -690,7 +715,7 @@ gtk_widget_modify_bg(local_video, GTK_STATE_NORMAL, &color); g_signal_connect(G_OBJECT(local_video), "realize", G_CALLBACK(realize_cb), data); - gtk_container_add(GTK_CONTAINER(plug), local_video); + gtk_container_add(GTK_CONTAINER(aspect), local_video); gtk_widget_set_size_request (GTK_WIDGET(local_video), 160, 120); gtk_widget_show(local_video); @@ -700,28 +725,13 @@ } if (type & PURPLE_MEDIA_RECV_AUDIO) { - GtkWidget *volume = gtk_hscale_new_with_range(0.0, 100.0, 5.0); - gtk_range_set_increments(GTK_RANGE(volume), 5.0, 25.0); - gtk_range_set_value(GTK_RANGE(volume), - purple_prefs_get_int( - "/pidgin/media/audio/volume/output")); - gtk_scale_set_draw_value(GTK_SCALE(volume), FALSE); - g_signal_connect (G_OBJECT(volume), "value-changed", - G_CALLBACK(pidgin_media_output_volume_changed), - media); gtk_box_pack_end(GTK_BOX(recv_widget), - volume, FALSE, FALSE, 0); - gtk_widget_show(volume); - - gtkmedia->priv->recv_progress = gtk_progress_bar_new(); - gtk_widget_set_size_request(gtkmedia->priv->recv_progress, 320, 10); - gtk_box_pack_end(GTK_BOX(recv_widget), - gtkmedia->priv->recv_progress, FALSE, FALSE, 0); - gtk_widget_show(gtkmedia->priv->recv_progress); + pidgin_media_add_audio_widget(gtkmedia, + PURPLE_MEDIA_RECV_AUDIO), FALSE, FALSE, 0); } if (type & PURPLE_MEDIA_SEND_AUDIO) { GstElement *media_src; - GtkWidget *hbox, *volume; + GtkWidget *hbox; hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); gtk_box_pack_end(GTK_BOX(send_widget), hbox, FALSE, FALSE, 0); @@ -735,28 +745,13 @@ gtk_widget_show(gtkmedia->priv->mute); gtk_widget_show(GTK_WIDGET(hbox)); - volume = gtk_hscale_new_with_range(0.0, 100.0, 5.0); - gtk_range_set_increments(GTK_RANGE(volume), 5.0, 25.0); - gtk_range_set_value(GTK_RANGE(volume), - purple_prefs_get_int( - "/pidgin/media/audio/volume/input")); - gtk_scale_set_draw_value(GTK_SCALE(volume), FALSE); - g_signal_connect (G_OBJECT(volume), "value-changed", - G_CALLBACK (pidgin_media_input_volume_changed), - media); - gtk_box_pack_end(GTK_BOX(send_widget), - volume, FALSE, FALSE, 0); - gtk_widget_show(volume); - media_src = purple_media_get_src(media, sid); gtkmedia->priv->send_level = gst_bin_get_by_name( GST_BIN(media_src), "sendlevel"); - gtkmedia->priv->send_progress = gtk_progress_bar_new(); - gtk_widget_set_size_request(gtkmedia->priv->send_progress, 320, 10); gtk_box_pack_end(GTK_BOX(send_widget), - gtkmedia->priv->send_progress, FALSE, FALSE, 0); - gtk_widget_show(gtkmedia->priv->send_progress); + pidgin_media_add_audio_widget(gtkmedia, + PURPLE_MEDIA_SEND_AUDIO), FALSE, FALSE, 0); gtk_widget_show(gtkmedia->priv->mute); } @@ -932,15 +927,13 @@ static gboolean pidgin_media_new_cb(PurpleMediaManager *manager, PurpleMedia *media, - PurpleConnection *pc, gchar *screenname, gpointer nul) + PurpleAccount *account, gchar *screenname, gpointer nul) { PidginMedia *gtkmedia = PIDGIN_MEDIA( pidgin_media_new(media, screenname)); - PurpleBuddy *buddy = purple_find_buddy( - purple_connection_get_account(pc), screenname); + PurpleBuddy *buddy = purple_find_buddy(account, screenname); const gchar *alias = buddy ? purple_buddy_get_contact_alias(buddy) : screenname; - gtkmedia->priv->pc = pc; gtk_window_set_title(GTK_WINDOW(gtkmedia), alias); if (purple_media_is_initiator(media, NULL, NULL) == TRUE)
--- a/pidgin/gtkmedia.h Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkmedia.h Fri Apr 17 21:29:18 2009 +0000 @@ -1,8 +1,9 @@ /** - * @file media.h Account API - * @ingroup core - * - * Pidgin + * @file gtkmedia.h Pidgin Media API + * @ingroup pidgin + */ + +/* Pidgin * * 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
--- a/pidgin/gtkmenutray.c Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkmenutray.c Fri Apr 17 21:29:18 2009 +0000 @@ -21,9 +21,7 @@ #include "gtkmenutray.h" -#include <gtk/gtkeventbox.h> -#include <gtk/gtkiconfactory.h> -#include <gtk/gtkversion.h> +#include <gtk/gtk.h> /****************************************************************************** * Enums
--- a/pidgin/gtkmenutray.h Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkmenutray.h Fri Apr 17 21:29:18 2009 +0000 @@ -24,9 +24,7 @@ #ifndef PIDGIN_MENU_TRAY_H #define PIDGIN_MENU_TRAY_H -#include <gtk/gtkhbox.h> -#include <gtk/gtkmenuitem.h> -#include <gtk/gtktooltips.h> +#include <gtk/gtk.h> #define PIDGIN_TYPE_MENU_TRAY (pidgin_menu_tray_get_gtype()) #define PIDGIN_MENU_TRAY(obj) (GTK_CHECK_CAST((obj), PIDGIN_TYPE_MENU_TRAY, PidginMenuTray))
--- a/pidgin/gtkplugin.c Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkplugin.c Fri Apr 17 21:29:18 2009 +0000 @@ -135,7 +135,13 @@ gtk_list_store_append (ls, &iter); - name = g_markup_escape_text(plug->info->name ? _(plug->info->name) : g_basename(plug->path), -1); + if (plug->info->name) { + name = g_markup_escape_text(_(plug->info->name), -1); + } else { + char *tmp = g_path_get_basename(plug->path); + name = g_markup_escape_text(tmp, -1); + g_free(tmp); + } version = g_markup_escape_text(purple_plugin_get_version(plug), -1); summary = g_markup_escape_text(purple_plugin_get_summary(plug), -1);
--- a/pidgin/gtksound.c Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtksound.c Fri Apr 17 21:29:18 2009 +0000 @@ -226,9 +226,9 @@ account_signon_cb(PurpleConnection *gc, gpointer data) { if (mute_login_sounds_timeout != 0) - g_source_remove(mute_login_sounds_timeout); + purple_timeout_remove(mute_login_sounds_timeout); mute_login_sounds = TRUE; - mute_login_sounds_timeout = purple_timeout_add(10000, unmute_login_sounds_cb, NULL); + mute_login_sounds_timeout = purple_timeout_add_seconds(10, unmute_login_sounds_cb, NULL); } const char *
--- a/pidgin/gtksourceiter.h Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtksourceiter.h Fri Apr 17 21:29:18 2009 +0000 @@ -28,7 +28,7 @@ #ifndef _PIDGINSOURCEITER_H_ #define _PIDGINSOURCEITER_H_ -#include <gtk/gtktextiter.h> +#include <gtk/gtk.h> G_BEGIN_DECLS
--- a/pidgin/gtksourceundomanager.h Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtksourceundomanager.h Fri Apr 17 21:29:18 2009 +0000 @@ -26,7 +26,7 @@ #ifndef __GTK_SOURCE_UNDO_MANAGER_H__ #define __GTK_SOURCE_UNDO_MANAGER_H__ -#include <gtk/gtktextbuffer.h> +#include <gtk/gtk.h> #define GTK_SOURCE_TYPE_UNDO_MANAGER (gtk_source_undo_manager_get_type ()) #define GTK_SOURCE_UNDO_MANAGER(obj) (GTK_CHECK_CAST ((obj), GTK_SOURCE_TYPE_UNDO_MANAGER, GtkSourceUndoManager))
--- a/pidgin/gtkstatusbox.c Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkstatusbox.c Fri Apr 17 21:29:18 2009 +0000 @@ -67,7 +67,8 @@ # endif #endif -#define TYPING_TIMEOUT 4000 +/* Timeout for typing notifications in seconds */ +#define TYPING_TIMEOUT 4 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data); static void imhtml_format_changed_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, void *data); @@ -1155,7 +1156,7 @@ /* Reset the status if Escape was pressed */ if (event->keyval == GDK_Escape) { - g_source_remove(status_box->typing); + purple_timeout_remove(status_box->typing); status_box->typing = 0; if (status_box->account != NULL) update_to_reflect_account_status(status_box, status_box->account, @@ -1168,8 +1169,8 @@ } pidgin_status_box_pulse_typing(status_box); - g_source_remove(status_box->typing); - status_box->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box); + purple_timeout_remove(status_box->typing); + status_box->typing = purple_timeout_add_seconds(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box); return FALSE; } @@ -2596,7 +2597,7 @@ return; } - g_source_remove(status_box->typing); + purple_timeout_remove(status_box->typing); status_box->typing = 0; activate_currently_selected_status(status_box); @@ -2624,7 +2625,7 @@ DATA_COLUMN, &data, -1); if (status_box->typing != 0) - g_source_remove(status_box->typing); + purple_timeout_remove(status_box->typing); status_box->typing = 0; if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) @@ -2692,7 +2693,7 @@ GtkTextIter start, end; GtkTextBuffer *buffer; gtk_widget_show_all(status_box->vbox); - status_box->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box); + status_box->typing = purple_timeout_add_seconds(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box); gtk_widget_grab_focus(status_box->imhtml); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(status_box->imhtml)); gtk_text_buffer_get_bounds(buffer, &start, &end); @@ -2741,9 +2742,9 @@ { if (status_box->typing != 0) { pidgin_status_box_pulse_typing(status_box); - g_source_remove(status_box->typing); + purple_timeout_remove(status_box->typing); } - status_box->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box); + status_box->typing = purple_timeout_add_seconds(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, status_box); } pidgin_status_box_refresh(status_box); }
--- a/pidgin/gtkstatusbox.h Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkstatusbox.h Fri Apr 17 21:29:18 2009 +0000 @@ -34,8 +34,6 @@ #include "imgstore.h" #include "savedstatuses.h" #include "status.h" -#include <gtk/gtktreemodel.h> -#include <gtk/gtktreeview.h> G_BEGIN_DECLS
--- a/pidgin/gtkutils.c Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/gtkutils.c Fri Apr 17 21:29:18 2009 +0000 @@ -950,7 +950,7 @@ "accel changed, scheduling save.\n"); if (!accels_save_timer) - accels_save_timer = g_timeout_add(5000, pidgin_save_accels, + accels_save_timer = purple_timeout_add_seconds(5, pidgin_save_accels, NULL); }
--- a/pidgin/minidialog.c Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/minidialog.c Fri Apr 17 21:29:18 2009 +0000 @@ -26,8 +26,7 @@ #include "internal.h" -#include <gtk/gtkhbox.h> -#include <gtk/gtkbutton.h> +#include <gtk/gtk.h> #include "libpurple/prefs.h"
--- a/pidgin/minidialog.h Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/minidialog.h Fri Apr 17 21:29:18 2009 +0000 @@ -28,8 +28,7 @@ #define __PIDGIN_MINI_DIALOG_H__ #include <glib-object.h> -#include <gtk/gtkvbox.h> -#include <gtk/gtklabel.h> +#include <gtk/gtk.h> G_BEGIN_DECLS
--- a/pidgin/pidginstock.c Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/pidginstock.c Fri Apr 17 21:29:18 2009 +0000 @@ -201,7 +201,7 @@ #ifdef USE_VV { PIDGIN_STOCK_TOOLBAR_AUDIO_CALL, "toolbar", "audio-call.png", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, { PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, "toolbar", "video-call.png", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, - { PIDGIN_STOCK_TOOLBAR_AUDIO_VIDEO_CALL, "toolbar", "audio-video-call.png", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, + { PIDGIN_STOCK_TOOLBAR_AUDIO_VIDEO_CALL, "toolbar", "audio-video-call.png", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, #endif };
--- a/pidgin/pidginstock.h Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/pidginstock.h Fri Apr 17 21:29:18 2009 +0000 @@ -23,7 +23,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ -#include <gtk/gtkstock.h> +#include <gtk/gtk.h> #include "gtkstatus-icon-theme.h" #ifndef _PIDGIN_STOCK_H_
--- a/pidgin/plugins/cap/cap.c Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/plugins/cap/cap.c Fri Apr 17 21:29:18 2009 +0000 @@ -135,7 +135,7 @@ /* g_free(stats->hourly_usage); */ /* g_free(stats->daily_usage); */ if (stats->timeout_source_id != 0) - g_source_remove(stats->timeout_source_id); + purple_timeout_remove(stats->timeout_source_id); g_free(stats); } @@ -352,7 +352,7 @@ if (buddy == NULL) return; - interval = purple_prefs_get_int("/plugins/gtk/cap/max_msg_difference") * 1000 * 60; + interval = purple_prefs_get_int("/plugins/gtk/cap/max_msg_difference") * 60; words = word_count(message); stats = get_stats_for(buddy); @@ -361,9 +361,9 @@ stats->last_message = time(NULL); stats->last_message_status_id = purple_status_get_id(get_status_for(buddy)); if(stats->timeout_source_id != 0) - g_source_remove(stats->timeout_source_id); + purple_timeout_remove(stats->timeout_source_id); - stats->timeout_source_id = g_timeout_add(interval, max_message_difference_cb, stats); + stats->timeout_source_id = purple_timeout_add_seconds(interval, max_message_difference_cb, stats); } /* received-im-msg */ @@ -386,7 +386,7 @@ * then cancel the timeout callback. */ if(stats->timeout_source_id != 0) { purple_debug_info("cap", "Cancelling timeout callback\n"); - g_source_remove(stats->timeout_source_id); + purple_timeout_remove(stats->timeout_source_id); stats->timeout_source_id = 0; } @@ -697,7 +697,7 @@ static void cancel_conversation_timeouts(gpointer key, gpointer value, gpointer user_data) { CapStatistics *stats = value; if(stats->timeout_source_id != 0) { - g_source_remove(stats->timeout_source_id); + purple_timeout_remove(stats->timeout_source_id); stats->timeout_source_id = 0; } }
--- a/pidgin/plugins/mailchk.c Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/plugins/mailchk.c Fri Apr 17 21:29:18 2009 +0000 @@ -13,7 +13,7 @@ #define UNREAD_MAIL 0x02 #define NEW_MAIL 0x04 -static guint32 timer = 0; +static guint timer = 0; static GtkWidget *mail = NULL; static gint @@ -93,7 +93,7 @@ PurpleBuddyList *list = purple_get_blist(); if (list && PURPLE_IS_GTK_BLIST(list) && !timer) { check_timeout(NULL); /* we want the box to be drawn immediately */ - timer = g_timeout_add(2000, check_timeout, NULL); + timer = purple_timeout_add_seconds(2, check_timeout, NULL); } } @@ -102,7 +102,7 @@ { PurpleBuddyList *list = purple_get_blist(); if ((!list || !PURPLE_IS_GTK_BLIST(list) || !PIDGIN_BLIST(list)->vbox) && timer) { - g_source_remove(timer); + purple_timeout_remove(timer); timer = 0; } } @@ -123,7 +123,7 @@ } if (list && PURPLE_IS_GTK_BLIST(list) && PIDGIN_BLIST(list)->vbox) - timer = g_timeout_add(2000, check_timeout, NULL); + timer = purple_timeout_add_seconds(2, check_timeout, NULL); purple_signal_connect(conn_handle, "signed-on", plugin, PURPLE_CALLBACK(signon_cb), NULL); @@ -137,7 +137,7 @@ plugin_unload(PurplePlugin *plugin) { if (timer) - g_source_remove(timer); + purple_timeout_remove(timer); timer = 0; if (mail) gtk_widget_destroy(mail);
--- a/pidgin/plugins/musicmessaging/musicmessaging.c Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/plugins/musicmessaging/musicmessaging.c Fri Apr 17 21:29:18 2009 +0000 @@ -529,7 +529,7 @@ args[1] = "-session_id"; session_id = g_string_new(""); - g_string_sprintfa(session_id, "%d", mmconv_from_conv_loc(mmconv->conv)); + g_string_append_printf(session_id, "%d", mmconv_from_conv_loc(mmconv->conv)); args[2] = session_id->str; args[3] = NULL;
--- a/pidgin/plugins/ticker/gtkticker.h Fri Apr 17 21:29:11 2009 +0000 +++ b/pidgin/plugins/ticker/gtkticker.h Fri Apr 17 21:29:18 2009 +0000 @@ -26,8 +26,7 @@ #include <gdk/gdk.h> -#include <gtk/gtkcontainer.h> -#include <gtk/gtkmain.h> +#include <gtk/gtk.h> #ifdef __cplusplus
--- a/po/POTFILES.in Fri Apr 17 21:29:11 2009 +0000 +++ b/po/POTFILES.in Fri Apr 17 21:29:18 2009 +0000 @@ -37,6 +37,7 @@ finch/plugins/gnthistory.c finch/plugins/grouping.c finch/plugins/lastlog.c +finch/plugins/gnttinyurl.c libpurple/account.c libpurple/blist.c libpurple/certificate.c @@ -88,7 +89,6 @@ libpurple/protocols/jabber/buddy.c libpurple/protocols/jabber/chat.c libpurple/protocols/jabber/jabber.c -libpurple/protocols/jabber/jingle.c libpurple/protocols/jabber/libxmpp.c libpurple/protocols/jabber/message.c libpurple/protocols/jabber/parser.c