static void
infinoted_plugin_document_stream_user_join_func(InfRequest* request,
                                                const InfRequestResult* res,
                                                const GError* error,
                                                gpointer user_data)
{
  InfinotedPluginDocumentStreamStream* stream;
  InfUser* user;

  stream = (InfinotedPluginDocumentStreamStream*)user_data;
  stream->user_request = NULL;

  if(error != NULL)
  {
    infinoted_plugin_document_stream_send_error(stream, error->message);
  }
  else
  {
    inf_request_result_get_join_user(res, NULL, &user);

    g_assert(stream->user == NULL);
    stream->user = user;
    g_object_ref(stream->user);

    infinoted_plugin_document_stream_start(stream);
  }
}
Ejemplo n.º 2
0
	static void on_user_join_finished_static(InfRequest* request,
	                                         const InfRequestResult* res,
	                                         const GError* error,
	                                         gpointer user_data)
	{
		InfUser* user;
		inf_request_result_get_join_user(res, NULL, &user);

		static_cast<UserJoinInfo*>(user_data)->
			on_user_join_finished(user, error);
	}
Ejemplo n.º 3
0
static void
infinoted_plugin_linekeeper_user_join_cb(InfRequest* request,
                                         const InfRequestResult* result,
                                         const GError* error,
                                         gpointer user_data)
{
  InfinotedPluginLinekeeperSessionInfo* info;
  InfUser* user;

  info = (InfinotedPluginLinekeeperSessionInfo*)user_data;

  info->request = NULL;

  if(error != NULL)
  {
    infinoted_log_warning(
      infinoted_plugin_manager_get_log(info->plugin->manager),
      _("Could not join LineKeeper user for document: %s\n"),
      error->message
    );
  }
  else
  {
    inf_request_result_get_join_user(result, NULL, &user);

    info->user = user;
    g_object_ref(info->user);

    /* Initial run */
    infinoted_plugin_linekeeper_run(info);

    g_signal_connect(
      G_OBJECT(info->buffer),
      "text-inserted",
      G_CALLBACK(infinoted_plugin_linekeeper_text_inserted_cb),
      info
    );

    g_signal_connect(
      G_OBJECT(info->buffer),
      "text-erased",
      G_CALLBACK(infinoted_plugin_linekeeper_text_erased_cb),
      info
    );

    /* It can happen that while the request is being processed, the situation
     * changes again. */
    if(infinoted_plugin_linekeeper_has_available_users(info) == FALSE)
    {
      infinoted_plugin_linekeeper_remove_user(info);
    }
  }
}