#include <telepathy-glib/channel.h>
#include <telepathy-glib/dbus.h>
#include <telepathy-glib/util.h>
+#include <telepathy-glib/interfaces.h>
#include "empathy-tp-chat.h"
#include "empathy-tp-contact-factory.h"
for (l = priv->members; l; l = l->next) {
EmpathyContact *c = l->data;
- if (empathy_contact_get_handle (c) == handle) {
- if (remove) {
- /* Caller takes the reference. */
- priv->members = g_list_delete_link (
- priv->members, l);
- } else {
- g_object_ref (c);
- }
+ if (empathy_contact_get_handle (c) != handle) {
+ continue;
+ }
- return c;
+ if (remove) {
+ /* Caller takes the reference. */
+ priv->members = g_list_delete_link (priv->members, l);
+ } else {
+ g_object_ref (c);
}
+
+ return c;
}
return NULL;
EmpathyTpChat *chat)
{
EmpathyTpChatPriv *priv = GET_PRIV (chat);
- EmpathyContact *contact, *actor_contact = NULL;
+ EmpathyContact *contact;
+ EmpathyContact *actor_contact = NULL;
guint i;
if (actor != 0) {
actor_contact = chat_lookup_contact (chat, actor, FALSE);
if (actor_contact == NULL) {
- /* TODO: handle this a tad more gracefully: perhaps the
- * actor was a server op. We could use the contact-ids
- * detail of MembersChangedDetailed.
+ /* FIXME: handle this a tad more gracefully: perhaps
+ * the actor was a server op. We could use the
+ * contact-ids detail of MembersChangedDetailed.
*/
DEBUG ("actor %u not a channel member", actor);
}
/* Get initial member contacts */
members = tp_channel_group_get_members (priv->channel);
- handles = tp_intset_to_array (members);
+ handles = tp_intset_to_array (members);
empathy_tp_contact_factory_get_from_handles (priv->factory,
handles->len, (TpHandle *) handles->data,
tp_chat_got_added_contacts_cb, NULL, NULL, chat);
g_return_if_fail (EMPATHY_IS_TP_CHAT (chat));
g_return_if_fail (priv->ready);
- DEBUG ("Set state: %d", state);
- tp_cli_channel_interface_chat_state_call_set_chat_state (priv->channel, -1,
- state,
- tp_chat_async_cb,
- "setting chat state",
- NULL,
- G_OBJECT (chat));
+ if (tp_proxy_has_interface_by_id (priv->channel,
+ TP_IFACE_QUARK_CHANNEL_INTERFACE_CHAT_STATE)) {
+ DEBUG ("Set state: %d", state);
+ tp_cli_channel_interface_chat_state_call_set_chat_state (priv->channel, -1,
+ state,
+ tp_chat_async_cb,
+ "setting chat state",
+ NULL,
+ G_OBJECT (chat));
+ }
}