[libsoupmm] Add Soup::CookieJar



commit c2f90551f1b4ff7d79968fc0d8ce8f9e514698a7
Author: Siavash Safi <siavash siavashs org>
Date:   Thu Sep 3 17:59:14 2009 +0430

    Add Soup::CookieJar
    
    * codegen/extradefs/generate_extra_defs_libsoup.cc: Add
    SOUP_TYPE_COOKIE_JAR
    * codegen/m4/convert_libsoup.m4:
    * libsoup/.gitignore:
    * libsoup/libsoupmm.h:
    * libsoup/src/cookie-jar.ccg:
    * libsoup/src/cookie-jar.hg:
    * libsoup/src/filelist.am: Add cookie-jar.hg
    * libsoup/src/libsoup_signals.defs: Regenerated

 codegen/extradefs/generate_extra_defs_libsoup.cc |    1 +
 codegen/m4/convert_libsoup.m4                    |    3 +
 libsoup/.gitignore                               |    2 +
 libsoup/libsoupmm.h                              |    1 +
 libsoup/src/cookie-jar.ccg                       |   22 +++++++++
 libsoup/src/cookie-jar.hg                        |   56 ++++++++++++++++++++++
 libsoup/src/filelist.am                          |    2 +-
 libsoup/src/libsoup_signals.defs                 |   21 ++++++++
 8 files changed, 107 insertions(+), 1 deletions(-)
---
diff --git a/codegen/extradefs/generate_extra_defs_libsoup.cc b/codegen/extradefs/generate_extra_defs_libsoup.cc
index 6ce487f..4b87d00 100644
--- a/codegen/extradefs/generate_extra_defs_libsoup.cc
+++ b/codegen/extradefs/generate_extra_defs_libsoup.cc
@@ -28,6 +28,7 @@ int main(int, char**)
 
   std::cout << get_defs(SOUP_TYPE_ADDRESS);
   std::cout << get_defs(SOUP_TYPE_AUTH);
+  std::cout << get_defs(SOUP_TYPE_COOKIE_JAR);
   std::cout << get_defs(SOUP_TYPE_MESSAGE);
   std::cout << get_defs(SOUP_TYPE_SESSION);
   std::cout << get_defs(SOUP_TYPE_SERVER);
diff --git a/codegen/m4/convert_libsoup.m4 b/codegen/m4/convert_libsoup.m4
index f9250d2..1d79466 100644
--- a/codegen/m4/convert_libsoup.m4
+++ b/codegen/m4/convert_libsoup.m4
@@ -14,6 +14,9 @@ _CONVERSION(`SoupBuffer*',`Buffer&',($2)($3))
 _CONVERSION(`SoupClientContext*',`ClientContext',`Glib::wrap($3)')
 _CONVERSION(`ClientContext',`SoupClientContext*',($3).gobj())
 
+_CONVERSION(`Cookie&',`SoupCookie*',($3).gobj())
+_CONVERSION(`SoupCookie*',`Cookie&',($2)($3))
+
 _CONVERSION(`SoupMessage*',`Glib::RefPtr<Message>',`Glib::wrap($3)')
 _CONVERSION(`SoupMessage*',`const Glib::RefPtr<Message>&',`Glib::wrap($3)')
 _CONVERSION(`const Glib::RefPtr<Message>&',`SoupMessage*',__CONVERT_REFPTR_TO_P)
diff --git a/libsoup/.gitignore b/libsoup/.gitignore
index cc4450a..3ad855e 100644
--- a/libsoup/.gitignore
+++ b/libsoup/.gitignore
@@ -6,6 +6,8 @@
 /libsoupmm/auth.h
 /libsoupmm/cookie.cc
 /libsoupmm/cookie.h
+/libsoupmm/cookie-jar.cc
+/libsoupmm/cookie-jar.h
 /libsoupmm/enums.cc
 /libsoupmm/enums.h
 /libsoupmm/message.cc
diff --git a/libsoup/libsoupmm.h b/libsoup/libsoupmm.h
index 7add5c1..35660b2 100644
--- a/libsoup/libsoupmm.h
+++ b/libsoup/libsoupmm.h
@@ -26,6 +26,7 @@
 #include <libsoupmm/address.h>
 #include <libsoupmm/auth.h>
 #include <libsoupmm/cookie.h>
+#include <libsoupmm/cookie-jar.h>
 #include <libsoupmm/enums.h>
 #include <libsoupmm/form.h>
 #include <libsoupmm/message.h>
diff --git a/libsoup/src/cookie-jar.ccg b/libsoup/src/cookie-jar.ccg
new file mode 100644
index 0000000..602b24d
--- /dev/null
+++ b/libsoup/src/cookie-jar.ccg
@@ -0,0 +1,22 @@
+/* Copyright (c) 2009  Siavash Safi <siavashs siavashs org>
+ *
+ * This file is part of libsoupmm.
+ *
+ * libsoupmm is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2.1 of the License,
+ * or (at your option) any later version.
+ *
+ * libsoupmm is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace Soup
+{
+
+} // namespace Soup
diff --git a/libsoup/src/cookie-jar.hg b/libsoup/src/cookie-jar.hg
new file mode 100644
index 0000000..c539110
--- /dev/null
+++ b/libsoup/src/cookie-jar.hg
@@ -0,0 +1,56 @@
+/* Copyright (c) 2009  Siavash Safi <siavashs siavashs org>
+ *
+ * This file is part of libsoupmm.
+ *
+ * libsoupmm is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 2.1 of the License,
+ * or (at your option) any later version.
+ *
+ * libsoupmm is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <glibmm/object.h>
+#include <libsoupmm/cookie.h>
+#include <libsoupmm/uri.h>
+#include <libsoup/soup-cookie-jar.h>
+
+_DEFS(libsoupmm,libsoup)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Soup
+{
+
+class CookieJar : public Glib::Object
+{
+  _CLASS_GOBJECT(CookieJar, SoupCookieJar, SOUP_COOKIE_JAR, Glib::Object, GObject)
+  _STRUCT_NOT_HIDDEN
+
+protected:
+  _CTOR_DEFAULT
+
+public:
+  _WRAP_CREATE()
+
+  _WRAP_METHOD(std::string get_cookies(URI& uri, bool for_http=true) const, soup_cookie_jar_get_cookies)
+  _WRAP_METHOD(void set_cookie(URI& uri, const std::string& cookie), soup_cookie_jar_set_cookie)
+  _WRAP_METHOD(void add_cookie(Cookie& cookie), soup_cookie_jar_add_cookie)
+  _WRAP_METHOD(void delete_cookie(Cookie& cookie), soup_cookie_jar_delete_cookie)
+
+#m4 _CONVERSION(`GSList*', `Glib::SListHandle<Cookie*>', `$2($3, Glib::OWNERSHIP_DEEP)')
+  _WRAP_METHOD(Glib::SListHandle<Cookie*> all_cookies(), soup_cookie_jar_all_cookies)
+
+  _IGNORE(soup_cookie_jar_save)
+
+  _WRAP_SIGNAL(void changed(Cookie& old_cookie, Cookie& new_cookie), "changed")
+
+  _WRAP_PROPERTY("read-only", bool)
+};
+
+} // namespace Soup
diff --git a/libsoup/src/filelist.am b/libsoup/src/filelist.am
index 44a5f92..2d81237 100644
--- a/libsoup/src/filelist.am
+++ b/libsoup/src/filelist.am
@@ -9,5 +9,5 @@ files_defs =			\
 	libsoup_docs.xml	\
 	libsoup_docs_override.xml
 
-files_hg  = address.hg auth.hg cookie.hg enums.hg message.hg message-body.hg server.hg session.hg uri.hg
+files_hg  = address.hg auth.hg cookie.hg cookie-jar.hg enums.hg message.hg message-body.hg server.hg session.hg uri.hg
 files_ccg = $(files_hg:.hg=.ccg)
diff --git a/libsoup/src/libsoup_signals.defs b/libsoup/src/libsoup_signals.defs
index 10e879c..7f7d7f0 100644
--- a/libsoup/src/libsoup_signals.defs
+++ b/libsoup/src/libsoup_signals.defs
@@ -92,6 +92,27 @@
   (construct-only #f)
 )
 
+;; From SoupCookieJar
+
+(define-signal changed
+  (of-object "SoupCookieJar")
+  (return-type "void")
+  (when "first")
+  (parameters
+    '("SoupCookie*" "p0")
+    '("SoupCookie*" "p1")
+  )
+)
+
+(define-property read-only
+  (of-object "SoupCookieJar")
+  (prop-type "GParamBoolean")
+  (docs "Whether or not the cookie jar is read-only")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
 ;; From SoupMessage
 
 (define-signal wrote-informational



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]