comparison libpurple/media.c @ 26606:df9042312063

Switch media to store accounts rather than connections. This for the most part stops it from crashing when ending a session when the connection has been interrupted.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Thu, 09 Apr 2009 21:35:06 +0000
parents 90c65a8575bf
children 4f2f5659aa0d 538b4175fd24
comparison
equal deleted inserted replaced
26605:6a3943412f2d 26606:df9042312063
26 26
27 #include <string.h> 27 #include <string.h>
28 28
29 #include "internal.h" 29 #include "internal.h"
30 30
31 #include "connection.h" 31 #include "account.h"
32 #include "marshallers.h" 32 #include "marshallers.h"
33 #include "media.h" 33 #include "media.h"
34 #include "media-gst.h" 34 #include "media-gst.h"
35 #include "mediamanager.h" 35 #include "mediamanager.h"
36 #include "network.h" 36 #include "network.h"
107 107
108 struct _PurpleMediaPrivate 108 struct _PurpleMediaPrivate
109 { 109 {
110 #ifdef USE_VV 110 #ifdef USE_VV
111 PurpleMediaManager *manager; 111 PurpleMediaManager *manager;
112 PurpleConnection *pc; 112 PurpleAccount *account;
113 FsConference *conference; 113 FsConference *conference;
114 gboolean initiator; 114 gboolean initiator;
115 gpointer prpl_data; 115 gpointer prpl_data;
116 116
117 GHashTable *sessions; /* PurpleMediaSession table */ 117 GHashTable *sessions; /* PurpleMediaSession table */
164 static guint purple_media_signals[LAST_SIGNAL] = {0}; 164 static guint purple_media_signals[LAST_SIGNAL] = {0};
165 165
166 enum { 166 enum {
167 PROP_0, 167 PROP_0,
168 PROP_MANAGER, 168 PROP_MANAGER,
169 PROP_CONNECTION, 169 PROP_ACCOUNT,
170 PROP_CONFERENCE, 170 PROP_CONFERENCE,
171 PROP_INITIATOR, 171 PROP_INITIATOR,
172 PROP_PRPL_DATA, 172 PROP_PRPL_DATA,
173 }; 173 };
174 #endif 174 #endif
296 "Purple Media Manager", 296 "Purple Media Manager",
297 "The media manager that contains this media session.", 297 "The media manager that contains this media session.",
298 PURPLE_TYPE_MEDIA_MANAGER, 298 PURPLE_TYPE_MEDIA_MANAGER,
299 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); 299 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
300 300
301 g_object_class_install_property(gobject_class, PROP_CONNECTION, 301 g_object_class_install_property(gobject_class, PROP_ACCOUNT,
302 g_param_spec_pointer("connection", 302 g_param_spec_pointer("account",
303 "PurpleConnection", 303 "PurpleAccount",
304 "The connection this media session is on.", 304 "The account this media session is on.",
305 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); 305 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
306 306
307 g_object_class_install_property(gobject_class, PROP_CONFERENCE, 307 g_object_class_install_property(gobject_class, PROP_CONFERENCE,
308 g_param_spec_object("conference", 308 g_param_spec_object("conference",
309 "Farsight conference", 309 "Farsight conference",
526 media->priv->manager = g_value_get_object(value); 526 media->priv->manager = g_value_get_object(value);
527 g_object_ref(media->priv->manager); 527 g_object_ref(media->priv->manager);
528 528
529 purple_media_setup_pipeline(media); 529 purple_media_setup_pipeline(media);
530 break; 530 break;
531 case PROP_CONNECTION: 531 case PROP_ACCOUNT:
532 media->priv->pc = g_value_get_pointer(value); 532 media->priv->account = g_value_get_pointer(value);
533 break; 533 break;
534 case PROP_CONFERENCE: { 534 case PROP_CONFERENCE: {
535 if (media->priv->conference) 535 if (media->priv->conference)
536 gst_object_unref(media->priv->conference); 536 gst_object_unref(media->priv->conference);
537 media->priv->conference = g_value_get_object(value); 537 media->priv->conference = g_value_get_object(value);
562 562
563 switch (prop_id) { 563 switch (prop_id) {
564 case PROP_MANAGER: 564 case PROP_MANAGER:
565 g_value_set_object(value, media->priv->manager); 565 g_value_set_object(value, media->priv->manager);
566 break; 566 break;
567 case PROP_CONNECTION: 567 case PROP_ACCOUNT:
568 g_value_set_pointer(value, media->priv->pc); 568 g_value_set_pointer(value, media->priv->account);
569 break; 569 break;
570 case PROP_CONFERENCE: 570 case PROP_CONFERENCE:
571 g_value_set_object(value, media->priv->conference); 571 g_value_set_object(value, media->priv->conference);
572 break; 572 break;
573 case PROP_INITIATOR: 573 case PROP_INITIATOR:
2053 2053
2054 return TRUE; 2054 return TRUE;
2055 } 2055 }
2056 #endif 2056 #endif
2057 2057
2058 PurpleConnection * 2058 PurpleAccount *
2059 purple_media_get_connection(PurpleMedia *media) 2059 purple_media_get_account(PurpleMedia *media)
2060 { 2060 {
2061 #ifdef USE_VV 2061 #ifdef USE_VV
2062 PurpleConnection *pc; 2062 PurpleAccount *account;
2063 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); 2063 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
2064 g_object_get(G_OBJECT(media), "connection", &pc, NULL); 2064 g_object_get(G_OBJECT(media), "account", &account, NULL);
2065 return pc; 2065 return account;
2066 #else 2066 #else
2067 return NULL; 2067 return NULL;
2068 #endif 2068 #endif
2069 } 2069 }
2070 2070