#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpChat)
typedef struct {
gboolean dispose_has_run;
+ TpAccount *account;
TpConnection *connection;
EmpathyContact *user;
EmpathyContact *remote_contact;
enum {
PROP_0,
+ PROP_ACCOUNT,
PROP_CHANNEL,
PROP_REMOTE_CONTACT,
PROP_PASSWORD_NEEDED,
/* FIXME: InvitationMessage ? */
NULL);
- req = tp_account_channel_request_new (
- empathy_get_account_for_connection (priv->connection), props,
+ req = tp_account_channel_request_new (priv->account, props,
EMPATHY_DISPATCHER_NON_USER_ACTION);
/* Although this is a MUC, it's anonymous, so CreateChannel is
priv->dispose_has_run = TRUE;
+ tp_clear_object (&priv->account);
+
if (priv->connection != NULL)
g_object_unref (priv->connection);
priv->connection = NULL;
priv = GET_PRIV (chat);
- priv->connection = g_object_ref (tp_channel_borrow_connection (priv->channel));
+ priv->connection = g_object_ref (tp_account_get_connection (priv->account));
tp_g_signal_connect_object (priv->channel, "invalidated",
G_CALLBACK (tp_chat_invalidated_cb),
chat, 0);
EmpathyTpChatPriv *priv = GET_PRIV (object);
switch (param_id) {
+ case PROP_ACCOUNT:
+ g_value_set_object (value, priv->account);
+ break;
case PROP_CHANNEL:
g_value_set_object (value, priv->channel);
break;
EmpathyTpChatPriv *priv = GET_PRIV (object);
switch (param_id) {
+ case PROP_ACCOUNT:
+ priv->account = g_value_dup_object (value);
+ break;
case PROP_CHANNEL:
priv->channel = g_value_dup_object (value);
break;
object_class->get_property = tp_chat_get_property;
object_class->set_property = tp_chat_set_property;
+ g_object_class_install_property (object_class,
+ PROP_ACCOUNT,
+ g_param_spec_object ("account",
+ "TpAccount",
+ "the account associated with the chat",
+ TP_TYPE_ACCOUNT,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+
g_object_class_install_property (object_class,
PROP_CHANNEL,
g_param_spec_object ("channel",
}
EmpathyTpChat *
-empathy_tp_chat_new (TpChannel *channel)
+empathy_tp_chat_new (TpAccount *account,
+ TpChannel *channel)
{
return g_object_new (EMPATHY_TYPE_TP_CHAT,
+ "account", account,
"channel", channel,
NULL);
}
return priv->channel;
}
+TpAccount *
+empathy_tp_chat_get_account (EmpathyTpChat *chat)
+{
+ EmpathyTpChatPriv *priv = GET_PRIV (chat);
+
+ g_return_val_if_fail (EMPATHY_IS_TP_CHAT (chat), NULL);
+
+ return priv->account;
+}
+
TpConnection *
empathy_tp_chat_get_connection (EmpathyTpChat *chat)
{
return tp_channel_borrow_connection (priv->channel);
}
-
gboolean
empathy_tp_chat_is_ready (EmpathyTpChat *chat)
{
} EmpathyTpChatProperty;
GType empathy_tp_chat_get_type (void) G_GNUC_CONST;
-EmpathyTpChat *empathy_tp_chat_new (TpChannel *channel);
+EmpathyTpChat *empathy_tp_chat_new (TpAccount *account,
+ TpChannel *channel);
const gchar * empathy_tp_chat_get_id (EmpathyTpChat *chat);
EmpathyContact *empathy_tp_chat_get_remote_contact (EmpathyTpChat *chat);
TpChannel * empathy_tp_chat_get_channel (EmpathyTpChat *chat);
+TpAccount * empathy_tp_chat_get_account (EmpathyTpChat *chat);
TpConnection * empathy_tp_chat_get_connection (EmpathyTpChat *chat);
gboolean empathy_tp_chat_is_ready (EmpathyTpChat *chat);
void empathy_tp_chat_send (EmpathyTpChat *chat,