From 76d91a358bc072274953c2aaf8a768c331ac2a71 Mon Sep 17 00:00:00 2001
From: Evan Prodromou <evan@prodromou.name>
Date: Tue, 30 Dec 2008 16:19:57 -0500
Subject: [PATCH] better serialization of arrays and booleans in config output

darcs-hash:20081230211957-84dde-ea044934e16bb8ef89e762159ecea1fa008b65b9.gz
---
 _darcs/inventory                              |   4 +-
 ...a044934e16bb8ef89e762159ecea1fa008b65b9.gz | Bin 0 -> 280 bytes
 _darcs/pristine/actions/twitapilaconica.php   |  10 +++-
 _darcs/tentative_pristine                     |  54 ++++--------------
 actions/twitapilaconica.php                   |  10 +++-
 5 files changed, 32 insertions(+), 46 deletions(-)
 create mode 100644 _darcs/patches/20081230211957-84dde-ea044934e16bb8ef89e762159ecea1fa008b65b9.gz

diff --git a/_darcs/inventory b/_darcs/inventory
index 895091d014..6b875d2ae7 100644
--- a/_darcs/inventory
+++ b/_darcs/inventory
@@ -108,4 +108,6 @@ Evan Prodromou <evan@prodromou.name>**20081230205939]
 [add some breaks so that switch statement works
 Evan Prodromou <evan@prodromou.name>**20081230210114] 
 [implement the api/laconica/config method
-Evan Prodromou <evan@prodromou.name>**20081230211444] 
\ No newline at end of file
+Evan Prodromou <evan@prodromou.name>**20081230211444] 
+[better serialization of arrays and booleans in config output
+Evan Prodromou <evan@prodromou.name>**20081230211957] 
\ No newline at end of file
diff --git a/_darcs/patches/20081230211957-84dde-ea044934e16bb8ef89e762159ecea1fa008b65b9.gz b/_darcs/patches/20081230211957-84dde-ea044934e16bb8ef89e762159ecea1fa008b65b9.gz
new file mode 100644
index 0000000000000000000000000000000000000000..a9981814172990a8262222c3548582a4f49cd990
GIT binary patch
literal 280
zcmV+z0q6c7iwFP!000001C^0aPlG@Z#qWHIIWz$(QotBBit*yzyD`lahIZrbEZILb
zYW(g36%!Lk>)z(g+uxhaJa5Q3GGNIFl;Q)O&<wf(GzQ--AlI<bS`xAa!BA;##1^!7
zt#`rW9vPmDu8mgO!yR??Lp#<fqoVuevdFUQytv4UJiocTdV!tiS4dY_^;vf1-h{(e
zNbK06!nEDBkQYU84im4^N@-q`Bt`6^h3&={yiI_;l*!mWOxbsbj08qs9Nz|KQ{2TK
zr6(wl6J`LSfk@c(u(s$xi(~klHvdT!s+GE?C``iSN1Y4#0+N=7tnqtULW7-nT2?rC
e!++tO@u$*z>nwa)K623CeS8BD)n}Wj0ssKL*NTGx

literal 0
HcmV?d00001

diff --git a/_darcs/pristine/actions/twitapilaconica.php b/_darcs/pristine/actions/twitapilaconica.php
index 9d9fcef6f5..17b7b08729 100644
--- a/_darcs/pristine/actions/twitapilaconica.php
+++ b/_darcs/pristine/actions/twitapilaconica.php
@@ -119,7 +119,15 @@ class TwitapilaconicaAction extends TwitterapiAction
             foreach ($keys as $section => $settings) {
                 common_element_start($section);
                 foreach ($settings as $setting) {
-                    common_element($setting, null, common_config($section, $setting));
+                    $value = common_config($section, $setting);
+                    if (is_array($value)) {
+                        $value = implode(',', $value);
+                    } else if ($value === false) {
+                        $value = 'false';
+                    } else if ($value === true) {
+                        $value = 'true';
+                    }
+                    common_element($setting, null, $value);
                 }
                 common_element_end($section);
             }
diff --git a/_darcs/tentative_pristine b/_darcs/tentative_pristine
index 404e42f98d..2a7c664f3f 100644
--- a/_darcs/tentative_pristine
+++ b/_darcs/tentative_pristine
@@ -1,43 +1,11 @@
-hunk ./actions/twitapilaconica.php 92
-+     * URL: http://identi.ca/api/laconica/config.(xml|json)
-+     * Formats: xml, json
-hunk ./actions/twitapilaconica.php 105
-+        static $keys = array('site' => array('name', 'server', 'theme', 'path', 'fancy', 'language',
-+                                             'email', 'broughtby', 'broughtbyurl', 'closed',
-+                                             'inviteonly', 'private'),
-+                             'license' => array('url', 'title', 'image'),
-+                             'nickname' => array('featured'),
-+                             'throttle' => array('enabled', 'count', 'timespan'),
-+                             'xmpp' => array('enabled', 'server', 'user'));
-+
-hunk ./actions/twitapilaconica.php 114
--        common_server_error(_('API method under construction.'), 501);
-+
-+        switch ($apidata['content-type']) {
-+         case 'xml':
-+            $this->init_document('xml');
-+            // XXX: check that all sections and settings are legal XML elements
-+            foreach ($keys as $section => $settings) {
-+                common_element_start($section);
-+                foreach ($settings as $setting) {
-+                    common_element($setting, null, common_config($section, $setting));
-+                }
-+                common_element_end($section);
-+            }
-+            $this->end_document('xml');
-+            break;
-+         case 'json':
-+            $result = array();
-+            foreach ($keys as $section => $settings) {
-+                $result[$section] = array();
-+                foreach ($settings as $setting) {
-+                    $result[$section][$setting] = common_config($section, $setting);
-+                }
-+            }
-+            $this->init_document('json');
-+            $this->show_json_objects($result);
-+            $this->end_document('json');
-+            break;
-+         default:
-+            $this->client_error(_('API method not found!'), $code=404);
-+        }
+hunk ./actions/twitapilaconica.php 122
+-                    common_element($setting, null, common_config($section, $setting));
++                    $value = common_config($section, $setting);
++                    if (is_array($value)) {
++                        $value = implode(',', $value);
++                    } else if ($value === false) {
++                        $value = 'false';
++                    } else if ($value === true) {
++                        $value = 'true';
++                    }
++                    common_element($setting, null, $value);
diff --git a/actions/twitapilaconica.php b/actions/twitapilaconica.php
index 9d9fcef6f5..17b7b08729 100644
--- a/actions/twitapilaconica.php
+++ b/actions/twitapilaconica.php
@@ -119,7 +119,15 @@ class TwitapilaconicaAction extends TwitterapiAction
             foreach ($keys as $section => $settings) {
                 common_element_start($section);
                 foreach ($settings as $setting) {
-                    common_element($setting, null, common_config($section, $setting));
+                    $value = common_config($section, $setting);
+                    if (is_array($value)) {
+                        $value = implode(',', $value);
+                    } else if ($value === false) {
+                        $value = 'false';
+                    } else if ($value === true) {
+                        $value = 'true';
+                    }
+                    common_element($setting, null, $value);
                 }
                 common_element_end($section);
             }
-- 
2.39.5