X-Git-Url: https://git.0d.be/?p=empathy.git;a=blobdiff_plain;f=libempathy-gtk%2Fgossip-private-chat.c;fp=libempathy-gtk%2Fgossip-private-chat.c;h=fb7198ff0549e1dcb83117ef6a30bef6977b673d;hp=84cc156e8d0370634cda9356db2d6e2200c2ee7f;hb=e9da37418519e89f8489491310b5f3ca3ef59f76;hpb=03d20e55433ca5d11633dec62435ea66ebdaf1ae diff --git a/libempathy-gtk/gossip-private-chat.c b/libempathy-gtk/gossip-private-chat.c index 84cc156e..fb7198ff 100644 --- a/libempathy-gtk/gossip-private-chat.c +++ b/libempathy-gtk/gossip-private-chat.c @@ -33,10 +33,10 @@ #include #include -#include - #include #include +#include +#include //#include #include "gossip-private-chat.h" @@ -328,36 +328,44 @@ private_chat_setup (GossipPrivateChat *chat, } GossipPrivateChat * -gossip_private_chat_new (GossipContact *contact) +gossip_private_chat_new (McAccount *account, + TpChan *tp_chan) { - GossipPrivateChat *chat; - EmpathyTpChat *tp_chat; + GossipPrivateChat *chat; + EmpathyTpChat *tp_chat; + EmpathyContactManager *manager; + EmpathyTpContactList *list; + GossipContact *contact; - g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), NULL); + g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL); + g_return_val_if_fail (TELEPATHY_IS_CHAN (tp_chan), NULL); + + manager = empathy_contact_manager_new (); + list = empathy_contact_manager_get_list (manager, account); + contact = empathy_tp_contact_list_get_from_handle (list, tp_chan->handle); chat = g_object_new (GOSSIP_TYPE_PRIVATE_CHAT, NULL); - tp_chat = empathy_tp_chat_new_with_contact (contact); + tp_chat = empathy_tp_chat_new (account, tp_chan); private_chat_setup (chat, contact, tp_chat); + g_object_unref (tp_chat); + g_object_unref (contact); + g_object_unref (manager); return chat; } GossipPrivateChat * -gossip_private_chat_new_with_channel (GossipContact *contact, - TpChan *tp_chan) +gossip_private_chat_new_with_contact (GossipContact *contact) { GossipPrivateChat *chat; EmpathyTpChat *tp_chat; - McAccount *account; g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), NULL); - g_return_val_if_fail (TELEPATHY_IS_CHAN (tp_chan), NULL); - account = gossip_contact_get_account (contact); chat = g_object_new (GOSSIP_TYPE_PRIVATE_CHAT, NULL); - tp_chat = empathy_tp_chat_new (account, tp_chan); + tp_chat = empathy_tp_chat_new_with_contact (contact); private_chat_setup (chat, contact, tp_chat); g_object_unref (tp_chat);