summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiscomfitor <michael.blumenkrantz@gmail.com>2013-03-22 22:35:55 +0000
committerdiscomfitor <michael.blumenkrantz@gmail.com>2013-03-22 22:35:55 +0000
commit063dc6e3d567c01465724596148bb9ab31852ecb (patch)
tree88a58fe2fc91997ecc9afc1f5e2f41d6ad40f587
parent705efbe36b14e3043883a31e9566e87603cb37ee (diff)
simplify azy client fetch completion
-rw-r--r--src/lib/azy/azy_client_events.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/src/lib/azy/azy_client_events.c b/src/lib/azy/azy_client_events.c
index ad4f177..005c3f9 100644
--- a/src/lib/azy/azy_client_events.c
+++ b/src/lib/azy/azy_client_events.c
@@ -134,8 +134,11 @@ _azy_client_handler_get(Azy_Client_Handler_Data *hd)
134 content->data = hd->content_data; 134 content->data = hd->content_data;
135 if (hd->recv->buffer_stolen) goto out; 135 if (hd->recv->buffer_stolen) goto out;
136 136
137 if (hd->recv->transport == AZY_NET_TRANSPORT_JSON) /* assume block of json */ 137 switch (hd->recv->transport)
138 { 138 {
139 case AZY_NET_TRANSPORT_JSON: /* assume block of json */
140 case AZY_NET_TRANSPORT_XML:
141 case AZY_NET_TRANSPORT_ATOM:
139 if (!azy_content_deserialize(content, hd->recv)) 142 if (!azy_content_deserialize(content, hd->recv))
140 azy_content_error_faultmsg_set(content, AZY_CLIENT_ERROR_MARSHALIZER, "Call return parsing failed."); 143 azy_content_error_faultmsg_set(content, AZY_CLIENT_ERROR_MARSHALIZER, "Call return parsing failed.");
141 else if (hd->callback && content->retval && (!hd->callback(content->retval, &ret))) 144 else if (hd->callback && content->retval && (!hd->callback(content->retval, &ret)))
@@ -147,26 +150,8 @@ _azy_client_handler_get(Azy_Client_Handler_Data *hd)
147 ERR(buf, EBUF(hd->recv->buffer)); 150 ERR(buf, EBUF(hd->recv->buffer));
148 } 151 }
149 content->ret = ret; 152 content->ret = ret;
150 } 153 break;
151 else if (((hd->recv->transport == AZY_NET_TRANSPORT_XML) || (hd->recv->transport == AZY_NET_TRANSPORT_ATOM)) && (!hd->callback)) /* assume rss */ 154 default:
152 {
153 Eina_Bool success;
154
155 success = azy_content_deserialize_xml(content, (char *)EBUF(hd->recv->buffer), EBUFLEN(hd->recv->buffer));
156 if (!success)
157 {
158 if (!azy_content_error_is_set(content))
159 azy_content_error_faultmsg_set(content, AZY_CLIENT_ERROR_MARSHALIZER, "Call return parsing failed.");
160 }
161 if (azy_content_error_is_set(content))
162 {
163 char buf[64];
164 snprintf(buf, sizeof(buf), "%" PRIi64 " bytes:\n<<<<<<<<<<<<<\n%%.%" PRIi64 "s\n<<<<<<<<<<<<<", EBUFLEN(hd->recv->buffer), EBUFLEN(hd->recv->buffer));
165 ERR(buf, EBUF(hd->recv->buffer));
166 }
167 }
168 else
169 {
170 content->ret = hd->recv->buffer; 155 content->ret = hd->recv->buffer;
171 hd->recv->buffer = NULL; 156 hd->recv->buffer = NULL;
172 } 157 }