Пример #1
0
static void
soup_cookie_jar_text_class_init (SoupCookieJarTextClass *text_class)
{
	SoupCookieJarClass *cookie_jar_class =
		SOUP_COOKIE_JAR_CLASS (text_class);
	GObjectClass *object_class = G_OBJECT_CLASS (text_class);

	g_type_class_add_private (text_class, sizeof (SoupCookieJarTextPrivate));

	cookie_jar_class->is_persistent = soup_cookie_jar_text_is_persistent;
	cookie_jar_class->changed       = soup_cookie_jar_text_changed;

	object_class->finalize     = soup_cookie_jar_text_finalize;
	object_class->set_property = soup_cookie_jar_text_set_property;
	object_class->get_property = soup_cookie_jar_text_get_property;

	/**
	 * SOUP_COOKIE_JAR_TEXT_FILENAME:
	 *
	 * Alias for the #SoupCookieJarText:filename property. (The
	 * cookie-storage filename.)
	 **/
	g_object_class_install_property (
		object_class, PROP_FILENAME,
		g_param_spec_string (SOUP_COOKIE_JAR_TEXT_FILENAME,
				     "Filename",
				     "Cookie-storage filename",
				     NULL,
				     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}
Пример #2
0
static void cookiejar_changed(SoupCookieJar *self, SoupCookie *old_cookie, SoupCookie *new_cookie)
{
    FLOCK(COOKIEJAR(self)->lock, F_WRLCK);
    SoupDate *expire;
    if (new_cookie) {
    /* session-expire-time handling */
    if (vb.config.cookie_expire_time == 0) {
        soup_cookie_set_expires(new_cookie, NULL);

    } else if (vb.config.cookie_expire_time > 0 && new_cookie->expires) {
        expire = soup_date_new_from_now(vb.config.cookie_expire_time);
        if (soup_date_to_time_t(expire) < soup_date_to_time_t(new_cookie->expires)) {
        soup_cookie_set_expires(new_cookie, expire);
        }
        soup_date_free(expire);
    }

    /* session-cookie handling */
    if (!new_cookie->expires && vb.config.cookie_timeout) {
        expire = soup_date_new_from_now(vb.config.cookie_timeout);
        soup_cookie_set_expires(new_cookie, expire);
        soup_date_free(expire);
    }
    }
    SOUP_COOKIE_JAR_CLASS(cookiejar_parent_class)->changed(self, old_cookie, new_cookie);
    FLOCK(COOKIEJAR(self)->lock, F_UNLCK);
}
Пример #3
0
static void
soup_cookie_jar_sqlite_class_init (SoupCookieJarSqliteClass *sqlite_class)
{
	SoupCookieJarClass *cookie_jar_class =
		SOUP_COOKIE_JAR_CLASS (sqlite_class);
	GObjectClass *object_class = G_OBJECT_CLASS (sqlite_class);

	g_type_class_add_private (sqlite_class, sizeof (SoupCookieJarSqlitePrivate));

	cookie_jar_class->changed = changed;

	object_class->finalize     = finalize;
	object_class->set_property = set_property;
	object_class->get_property = get_property;

	/**
	 * SOUP_COOKIE_JAR_SQLITE_FILENAME:
	 *
	 * Alias for the #SoupCookieJarSqlite:filename property. (The
	 * cookie-storage filename.)
	 **/
	g_object_class_install_property (
		object_class, PROP_FILENAME,
		g_param_spec_string (SOUP_COOKIE_JAR_SQLITE_FILENAME,
				     "Filename",
				     "Cookie-storage filename",
				     NULL,
				     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}
Пример #4
0
static void cookiejar_class_init(CookieJarClass *klass)
{
    SOUP_COOKIE_JAR_CLASS(klass)->changed = cookiejar_changed;
    G_OBJECT_CLASS(klass)->get_property   = G_OBJECT_CLASS(cookiejar_parent_class)->get_property;
    G_OBJECT_CLASS(klass)->set_property   = cookiejar_set_property;
    G_OBJECT_CLASS(klass)->finalize       = cookiejar_finalize;
    g_object_class_override_property(G_OBJECT_CLASS(klass), 1, "filename");
}