示例#1
0
void
XCAP::CoreImpl::erase (gmref_ptr<Path> path,
		       sigc::slot1<void,std::string> callback)
{
  SoupSession* session = NULL;
  SoupMessage* message = NULL;
  cb_other_data* data = NULL;

  clear_old_sessions ();

  /* all of this is freed in the result callback */
  session = soup_session_async_new_with_options ("user-agent", "ekiga", NULL);
  message = soup_message_new ("DELETE", path->to_uri ().c_str ());
  data = new cb_other_data;
  data->core = this;
  data->path = path;
  data->callback = callback;

  g_signal_connect (session, "authenticate",
		    G_CALLBACK (authenticate_other_callback), data);

  soup_session_queue_message (session, message,
			      result_other_callback, data);

  pending_sessions.push_back (session);
}
示例#2
0
文件: xcap-core.cpp 项目: GNOME/ekiga
void
XCAP::CoreImpl::write (boost::shared_ptr<Path> path,
		       const std::string content_type,
		       const std::string content,
		       boost::function1<void,std::string> callback)
{
  SoupSession* session = NULL;
  SoupMessage* message = NULL;
  cb_other_data* data = NULL;

  clear_old_sessions ();

  /* all of this is freed in the result callback */
  session = soup_session_async_new_with_options ("user-agent", "ekiga", NULL);
  message = soup_message_new ("PUT", path->to_uri ().c_str ());
  soup_message_set_request (message, content_type.c_str (),
			    SOUP_MEMORY_COPY,
			    content.c_str (), content.length ());

  data = new cb_other_data;
  data->core = this;
  data->path = path;
  data->callback = callback;

  g_signal_connect (session, "authenticate",
		    G_CALLBACK (authenticate_other_callback), data);

  soup_session_queue_message (session, message,
			      result_other_callback, data);

  pending_sessions.push_back (session);
}
示例#3
0
文件: xcap-core.cpp 项目: GNOME/ekiga
void
XCAP::CoreImpl::read (boost::shared_ptr<Path> path,
		      boost::function2<void, bool, std::string> callback)
{
  SoupSession* session = NULL;
  SoupMessage* message = NULL;
  cb_read_data* data = NULL;

  clear_old_sessions ();

  /* all of this is freed in the result callback */
  session = soup_session_async_new_with_options ("user-agent", "ekiga", NULL);
  message = soup_message_new ("GET", path->to_uri ().c_str ());
  data = new cb_read_data;
  data->core = this;
  data->path = path;
  data->callback = callback;

  g_signal_connect (session, "authenticate",
		    G_CALLBACK (authenticate_read_callback), data);

  soup_session_queue_message (session, message,
			      result_read_callback, data);

  pending_sessions.push_back (session);
}
示例#4
0
XCAP::CoreImpl::~CoreImpl ()
{
  /* we loop like this because aborting calls result_callback, and hence
   * makes the current iterator invalid : it gets pushed to the old sessions
   * list!
   */
  while (pending_sessions.begin () != pending_sessions.end ())
    soup_session_abort (*pending_sessions.begin ());

  /* now all pending sessions have been made old, so we can do that: */
  clear_old_sessions ();
}