All pastes #537006 Raw Edit

Unnamed

public c v1 · immutable
·published 2007-06-04 16:14 UTC
rendered paste body
static voidchat_state_changed_cb (EmpathyTpChat             *tp_chat,               GossipContact             *contact,               TelepathyChannelChatState  state,               GossipChat                *chat){    GossipChatPriv *priv;    GossipContact  *own_contact;    GList          *l;    gboolean        was_composing;    priv = GET_PRIV (chat);    own_contact = gossip_contact_get_user (contact);    if (gossip_contact_equal (own_contact, contact)) {        /* We don't care about our own chat state */        return;    }    was_composing = (priv->compositors != NULL);    /* Find the contact in the list. After that l is the list elem or NULL */    for (l = priv->compositors; l; l = l->next) {        if (gossip_contact_equal (contact, l->data)) {            break;        }    }    switch (state) {    case TP_CHANNEL_CHAT_STATE_GONE:    case TP_CHANNEL_CHAT_STATE_INACTIVE:    case TP_CHANNEL_CHAT_STATE_ACTIVE:        /* Contact is not composing */        if (l) {            priv->compositors = g_list_remove_link (priv->compositors, l);            g_object_unref (l->data);            g_list_free1 (l);        }        break;    case TP_CHANNEL_CHAT_STATE_PAUSED:    case TP_CHANNEL_CHAT_STATE_COMPOSING:        /* Contact is composing */        if (!l) {            priv->compositors = g_list_prepend (priv->compositors,                                g_object_ref (contact));        }               break;    default:        g_assert_not_reached ();    }    gossip_debug (DEBUG_DOMAIN, "Was composing: %s now composing: %s",              was_composing ? "yes" : "no",              priv->compositors ? "yes" : "no");    if ((was_composing && !priv->compositors) ||        (!was_composing && priv->compositors)) {        /* Composing state changed */        g_signal_emit (chat, signals[COMPOSING], 0,/* **************** HERE ********************/                   (gboolean) priv->compositors);/* **************** HERE ********************/    }}