예제 #1
0
    static void
fetion_contact_list_remove_contacts_async (TpBaseContactList *contact_list,
        TpHandleSet *contacts,
        GAsyncReadyCallback callback,
        gpointer user_data)
{
    FetionContactList *self = FETION_CONTACT_LIST (contact_list);
    FetionConnection *conn = FETION_CONNECTION (self->priv->conn);
    HybridAccount* account = conn->priv->account;

    TpHandleSet *removed = tp_handle_set_new (account->contact_repo);
    TpIntsetFastIter iter;
    TpHandle member;

    tp_intset_fast_iter_init (&iter, tp_handle_set_peek (contacts));

    while (tp_intset_fast_iter_next (&iter, &member))
    {
        HybridBuddy* buddy = hybrid_blist_find_buddy_by_handle(account,member);
        if (buddy == NULL)
            continue;
        if(!account->proto->info->im_ops->buddy_remove(account,buddy))
            continue;

        tp_handle_set_add (removed, member);
    }

    tp_base_contact_list_contacts_changed (contact_list, NULL, removed);

    tp_simple_async_report_success_in_idle ((GObject *) self, callback,
            user_data, fetion_contact_list_remove_contacts_async);
}
예제 #2
0
    static TpHandleSet *
fetion_contact_list_dup_group_members (TpBaseContactList *contact_list,
        const gchar *group)
{
    FetionContactList *self = FETION_CONTACT_LIST (contact_list);
    FetionConnection *conn = FETION_CONNECTION (self->priv->conn);
    HybridAccount* account = conn->priv->account;

    HybridGroup *lookup_group = hybrid_blist_find_group_by_name(account, group);

    TpIntsetFastIter iter;
    TpHandle member;
    TpHandleSet *members = tp_handle_set_new (account->contact_repo);

    tp_intset_fast_iter_init (&iter, tp_handle_set_peek (account->contacts));

    while (tp_intset_fast_iter_next (&iter, &member))
    {
        HybridBuddy* buddy = hybrid_blist_find_buddy_by_handle(account,member);
        if (buddy == NULL)
            continue;
        if (lookup_group != buddy->parent)
            continue;

        tp_handle_set_add (members, member);
    }

    return members;
}
예제 #3
0
static void
fetion_contact_list_request_subscription_async (
        TpBaseContactList *contact_list,
        TpHandleSet *contacts,
        const gchar *message,
        GAsyncReadyCallback callback,
        gpointer user_data)
{
    FetionContactList *self = FETION_CONTACT_LIST (contact_list);
    FetionConnection *conn = FETION_CONNECTION (self->priv->conn);
    HybridAccount* account = conn->priv->account;

    TpIntsetFastIter iter;
    TpHandle member;

    tp_intset_fast_iter_init (&iter, tp_handle_set_peek (contacts));

    while (tp_intset_fast_iter_next (&iter, &member))
    {
        HybridBuddy* buddy = hybrid_blist_find_buddy_by_handle(account,member);

        /* if they already authorized us, it's a no-op */
        if (buddy != NULL)
            continue;
        HybridGroup *default_group = hybrid_blist_find_group(account, "0"); 
        g_assert (default_group != NULL);

        account->proto->info->im_ops->buddy_add(account,default_group,tp_handle_inspect(account->contact_repo,member),NULL,message);

    }

    tp_simple_async_report_success_in_idle ((GObject *) self, callback,
            user_data, fetion_contact_list_request_subscription_async);
}
예제 #4
0
    static void
fetion_contact_list_add_to_group_async (TpBaseContactList *contact_list,
        const gchar *group,
        TpHandleSet *contacts,
        GAsyncReadyCallback callback,
        gpointer user_data)
{
    FetionContactList *self = FETION_CONTACT_LIST (contact_list);
    FetionConnection *conn =
        FETION_CONNECTION (self->priv->conn);
    HybridAccount *account = conn->priv->account;
    HybridGroup *dest_group = hybrid_blist_find_group_by_name(account, group);
    if(dest_group == NULL)
        return ; // group must exist

    TpHandleSet *new_to_group = tp_handle_set_new (account->contact_repo);

    TpIntsetFastIter iter;
    TpHandle member;

    tp_intset_fast_iter_init (&iter, tp_handle_set_peek (contacts));

    while (tp_intset_fast_iter_next (&iter, &member))
    {
        HybridBuddy* buddy = hybrid_blist_find_buddy_by_handle(account,member);
        if (buddy == NULL)
            continue; // must existed
        HybridGroup *origin_group = buddy->parent;
        if (origin_group == dest_group)
            continue;

        if(!account->proto->info->im_ops->buddy_move(account,buddy,dest_group))
            continue;

        tp_handle_set_add (new_to_group, member);

    }


    if (!tp_handle_set_is_empty (new_to_group))
        tp_base_contact_list_groups_changed (contact_list, new_to_group, &group, 1,
                NULL, 0);

    tp_handle_set_destroy (new_to_group);
    tp_simple_async_report_success_in_idle ((GObject *) self, callback,
            user_data, fetion_contact_list_add_to_group_async);
}
static void
tp_base_media_call_stream_complete_receiving_state_change (
    TpSvcCallStreamInterfaceMedia *iface,
    TpStreamFlowState state,
    DBusGMethodInvocation *context)
{
  TpBaseMediaCallStream *self = TP_BASE_MEDIA_CALL_STREAM (iface);
  TpBaseMediaCallStreamClass *klass =
      TP_BASE_MEDIA_CALL_STREAM_GET_CLASS (self);
  TpBaseCallChannel *channel = _tp_base_call_stream_get_channel (
      TP_BASE_CALL_STREAM (self));

  if (!correct_state_transition (self->priv->receiving_state, state))
    {
      GError e = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
          "Invalid receiving state transition" };
      dbus_g_method_return_error (context, &e);
      return;
    }

  self->priv->receiving_state = state;
  g_object_notify (G_OBJECT (self), "receiving-state");

  if (channel != NULL && TP_IS_BASE_MEDIA_CALL_CHANNEL (channel))
    _tp_base_media_call_channel_streams_receiving_state_changed (
        TP_BASE_MEDIA_CALL_CHANNEL (channel), TRUE);

  if (state == TP_STREAM_FLOW_STATE_STARTED)
    {
      TpIntsetFastIter iter;
      TpHandle contact;

      tp_intset_fast_iter_init (&iter, self->priv->receiving_requests);
      while (tp_intset_fast_iter_next (&iter, &contact))
        {
          if (klass->request_receiving != NULL)
            klass->request_receiving (self, contact, TRUE);
        }

      tp_intset_clear (self->priv->receiving_requests);
    }

  tp_svc_call_stream_interface_media_emit_receiving_state_changed (self, state);
  tp_svc_call_stream_interface_media_return_from_complete_receiving_state_change
      (context);
}