# HG changeset patch # User Mike Ruprecht # Date 1231550981 0 # Node ID ade5b2c510477949d4626fe4f0eb8b865de69ad1 # Parent 8b54456cba979e5cecfcdfb2c5babc2f1bcde237# Parent 5a3d1a3ae9f3d1676a9001d0e01fc9d397b0a089 merge of '403c70a10f0947c6a968f38acae33715ffad2fce' and 'db81111b84429495bfadbf169b190bf5b0d22535' diff -r 8b54456cba97 -r ade5b2c51047 libpurple/media.c --- a/libpurple/media.c Sat Jan 10 01:26:27 2009 +0000 +++ b/libpurple/media.c Sat Jan 10 01:29:41 2009 +0000 @@ -413,7 +413,7 @@ } -FsMediaType +static FsMediaType purple_media_to_fs_media_type(PurpleMediaSessionType type) { if (type & PURPLE_MEDIA_AUDIO) @@ -424,7 +424,7 @@ return 0; } -FsStreamDirection +static FsStreamDirection purple_media_to_fs_stream_direction(PurpleMediaSessionType type) { if ((type & PURPLE_MEDIA_AUDIO) == PURPLE_MEDIA_AUDIO || @@ -440,7 +440,7 @@ return FS_DIRECTION_NONE; } -PurpleMediaSessionType +static PurpleMediaSessionType purple_media_from_fs(FsMediaType type, FsStreamDirection direction) { PurpleMediaSessionType result = PURPLE_MEDIA_NONE; diff -r 8b54456cba97 -r ade5b2c51047 libpurple/media.h --- a/libpurple/media.h Sat Jan 10 01:26:27 2009 +0000 +++ b/libpurple/media.h Sat Jan 10 01:29:41 2009 +0000 @@ -109,41 +109,6 @@ */ GType purple_media_state_changed_get_type(void); -/**************************************************************************/ -/** @name Media Utility Functions */ -/**************************************************************************/ -/*@{*/ - -/** - * Converts a PurpleMediaSessionType to an FsMediaType. - * - * @param type The type to derive FsMediaType from - * - * @return The FsMediaType derived from type - */ -FsMediaType purple_media_to_fs_media_type(PurpleMediaSessionType type); - -/** - * Converts a PurpleMediaSessionType to an FsStreamDirection. - * - * @param type The type to derive FsMediaType from - * - * @return The FsMediaDirection derived from type - */ -FsStreamDirection purple_media_to_fs_stream_direction(PurpleMediaSessionType type); - -/** - * Converts an FsMediaType and FsStreamDirection into a PurpleMediaSessionType. - * - * @param type The type used to construct PurpleMediaSessionType - * @param direction The direction used to construct PurpleMediaSessionType - * - * @return The PurpleMediaSessionType constructed - */ -PurpleMediaSessionType purple_media_from_fs(FsMediaType type, FsStreamDirection direction); - -/*@}*/ - /** * Combines all the separate session types into a single PurpleMediaSessionType. * diff -r 8b54456cba97 -r ade5b2c51047 libpurple/protocols/jabber/Makefile.mingw --- a/libpurple/protocols/jabber/Makefile.mingw Sat Jan 10 01:26:27 2009 +0000 +++ b/libpurple/protocols/jabber/Makefile.mingw Sat Jan 10 01:29:41 2009 +0000 @@ -85,6 +85,7 @@ ## LIBS = \ -lglib-2.0 \ + -lgobject-2.0 \ -lxml2 \ -lws2_32 \ -lintl \ diff -r 8b54456cba97 -r ade5b2c51047 libpurple/protocols/jabber/google.c --- a/libpurple/protocols/jabber/google.c Sat Jan 10 01:26:27 2009 +0000 +++ b/libpurple/protocols/jabber/google.c Sat Jan 10 01:29:41 2009 +0000 @@ -31,7 +31,6 @@ #include "iq.h" #ifdef USE_VV -#include typedef struct { char *id; @@ -124,7 +123,6 @@ fs_codec_list_destroy(codecs); jabber_iq_send(iq); - gst_element_set_state(purple_media_get_pipeline(session->media), GST_STATE_PLAYING); } static void diff -r 8b54456cba97 -r ade5b2c51047 libpurple/protocols/jabber/jingle/content.c --- a/libpurple/protocols/jabber/jingle/content.c Sat Jan 10 01:26:27 2009 +0000 +++ b/libpurple/protocols/jabber/jingle/content.c Sat Jan 10 01:29:41 2009 +0000 @@ -18,7 +18,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ -#include "config.h" +#include "internal.h" + #include "debug.h" #include "content.h" #include "jingle.h" diff -r 8b54456cba97 -r ade5b2c51047 libpurple/protocols/jabber/jingle/iceudp.c --- a/libpurple/protocols/jabber/jingle/iceudp.c Sat Jan 10 01:26:27 2009 +0000 +++ b/libpurple/protocols/jabber/jingle/iceudp.c Sat Jan 10 01:29:41 2009 +0000 @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ +#include "internal.h" + #include "iceudp.h" #include "jingle.h" #include "debug.h" diff -r 8b54456cba97 -r ade5b2c51047 libpurple/protocols/jabber/jingle/jingle.c --- a/libpurple/protocols/jabber/jingle/jingle.c Sat Jan 10 01:26:27 2009 +0000 +++ b/libpurple/protocols/jabber/jingle/jingle.c Sat Jan 10 01:29:41 2009 +0000 @@ -19,7 +19,8 @@ * */ -#include "config.h" +#include "internal.h" + #include "content.h" #include "debug.h" #include "jingle.h" @@ -423,15 +424,17 @@ } } +static void +jingle_terminate_sessions_gh(gpointer key, gpointer value, gpointer user_data) +{ + g_object_unref(value); +} + void jingle_terminate_sessions(JabberStream *js) { - GList *values = js->sessions ? - g_hash_table_get_values(js->sessions) : NULL; - - for (; values; values = g_list_delete_link(values, values)) { - JingleSession *session = (JingleSession *)values->data; - g_object_unref(session); - } + if (js->sessions) + g_hash_table_foreach(js->sessions, + jingle_terminate_sessions_gh, NULL); } diff -r 8b54456cba97 -r ade5b2c51047 libpurple/protocols/jabber/jingle/rawudp.c --- a/libpurple/protocols/jabber/jingle/rawudp.c Sat Jan 10 01:26:27 2009 +0000 +++ b/libpurple/protocols/jabber/jingle/rawudp.c Sat Jan 10 01:29:41 2009 +0000 @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ +#include "internal.h" + #include "rawudp.h" #include "jingle.h" #include "debug.h" diff -r 8b54456cba97 -r ade5b2c51047 libpurple/protocols/jabber/jingle/rtp.c --- a/libpurple/protocols/jabber/jingle/rtp.c Sat Jan 10 01:26:27 2009 +0000 +++ b/libpurple/protocols/jabber/jingle/rtp.c Sat Jan 10 01:29:41 2009 +0000 @@ -372,8 +372,8 @@ gchar *senders; gchar *name; const gchar *transmitter; - FsMediaType type; - FsStreamDirection direction; + gboolean is_audio; + PurpleMediaSessionType type; JingleTransport *transport; /* maybe this create ought to just be in initiate and handle initiate */ @@ -396,23 +396,21 @@ else transmitter = "notransmitter"; - if (!strcmp(media_type, "audio")) - type = FS_MEDIA_TYPE_AUDIO; - else - type = FS_MEDIA_TYPE_VIDEO; + is_audio = !strcmp(media_type, "audio"); if (!strcmp(senders, "both")) - direction = FS_DIRECTION_BOTH; + type = is_audio == TRUE ? PURPLE_MEDIA_AUDIO + : PURPLE_MEDIA_VIDEO; else if (!strcmp(senders, "initiator") && jingle_session_is_initiator(session)) - direction = FS_DIRECTION_SEND; + type = is_audio == TRUE ? PURPLE_MEDIA_SEND_AUDIO + : PURPLE_MEDIA_SEND_VIDEO; else - direction = FS_DIRECTION_RECV; + type = is_audio == TRUE ? PURPLE_MEDIA_RECV_AUDIO + : PURPLE_MEDIA_RECV_VIDEO; purple_media_add_stream(media, name, remote_jid, - purple_media_from_fs(type, direction), - transmitter, 0, NULL); - + type, transmitter, 0, NULL); g_free(name); g_free(media_type); diff -r 8b54456cba97 -r ade5b2c51047 libpurple/protocols/jabber/jingle/session.c --- a/libpurple/protocols/jabber/jingle/session.c Sat Jan 10 01:26:27 2009 +0000 +++ b/libpurple/protocols/jabber/jingle/session.c Sat Jan 10 01:29:41 2009 +0000 @@ -18,7 +18,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ -#include "config.h" +#include "internal.h" + #include "content.h" #include "debug.h" #include "session.h" @@ -362,28 +363,31 @@ g_hash_table_lookup(js->sessions, sid) : NULL; } +static gboolean find_by_jid_ghr(gpointer key, + gpointer value, gpointer user_data) +{ + JingleSession *session = (JingleSession *)value; + const gchar *jid = user_data; + gboolean use_bare = strchr(jid, '/') == NULL; + gchar *remote_jid = jingle_session_get_remote_jid(session); + gchar *cmp_jid = use_bare ? jabber_get_bare_jid(remote_jid) + : g_strdup(remote_jid); + g_free(remote_jid); + if (!strcmp(jid, cmp_jid)) { + g_free(cmp_jid); + return TRUE; + } + g_free(cmp_jid); + + return FALSE; +} + JingleSession * jingle_session_find_by_jid(JabberStream *js, const gchar *jid) { - GList *values = (js->sessions) ? - g_hash_table_get_values(js->sessions) : NULL; - gboolean use_bare = strchr(jid, '/') == NULL; - - for (; values; values = g_list_delete_link(values, values)) { - JingleSession *session = (JingleSession *)values->data; - gchar *remote_jid = jingle_session_get_remote_jid(session); - gchar *cmp_jid = use_bare ? jabber_get_bare_jid(remote_jid) - : g_strdup(remote_jid); - g_free(remote_jid); - if (!strcmp(jid, cmp_jid)) { - g_free(cmp_jid); - g_list_free(values); - return session; - } - g_free(cmp_jid); - } - - return NULL; + return js->sessions != NULL ? + g_hash_table_find(js->sessions, + find_by_jid_ghr, (gpointer)jid) : NULL; } static xmlnode * diff -r 8b54456cba97 -r ade5b2c51047 libpurple/protocols/jabber/jingle/transport.c --- a/libpurple/protocols/jabber/jingle/transport.c Sat Jan 10 01:26:27 2009 +0000 +++ b/libpurple/protocols/jabber/jingle/transport.c Sat Jan 10 01:29:41 2009 +0000 @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ +#include "internal.h" + #include "transport.h" #include "jingle.h" #include "debug.h" diff -r 8b54456cba97 -r ade5b2c51047 pidgin/gtkprefs.c