aboutsummaryrefslogtreecommitdiff
path: root/src/capi.c
diff options
context:
space:
mode:
authorJorge Arellano Cid <jcid@dillo.org>2010-02-17 13:54:58 -0300
committerJorge Arellano Cid <jcid@dillo.org>2010-02-17 13:54:58 -0300
commitf8d6d864ed3b9bd82564b73ef264bd834f2e1bf2 (patch)
treeae2d1e28f3da13a1b239d36f7152f8d86550447b /src/capi.c
parente38ffe05b755b187db244ca65109adaaec52ee48 (diff)
Add the a_Capi_dpi_send_data() function
Diffstat (limited to 'src/capi.c')
-rw-r--r--src/capi.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/capi.c b/src/capi.c
index 54e199aa..5458f94e 100644
--- a/src/capi.c
+++ b/src/capi.c
@@ -474,11 +474,12 @@ const char *a_Capi_set_content_type(const DilloUrl *url, const char *ctype,
}
/*
- * Send a dpi cmd.
- * (For instance: add_bookmark, open_url, send_preferences, ...)
+ * Send data to a dpi (e.g. add_bookmark, open_url, send_preferences, ...)
+ * Most of the time we send dpi commands, but it also serves for raw data
+ * as with "view source".
*/
-int a_Capi_dpi_send_cmd(DilloUrl *url, void *bw, char *cmd, char *server,
- int flags)
+int a_Capi_dpi_send_data(DilloUrl *url, void *bw, char *data, int data_sz,
+ char *server, int flags)
{
capi_conn_t *conn;
DataBuf *dbuf;
@@ -487,7 +488,7 @@ int a_Capi_dpi_send_cmd(DilloUrl *url, void *bw, char *cmd, char *server,
/* open a new connection to server */
/* Create a new connection data struct and add it to the list */
- conn = Capi_conn_new(url, bw, server, cmd);
+ conn = Capi_conn_new(url, bw, server, data);
/* start the CCC operations */
a_Capi_ccc(OpStart, 2, BCK, a_Chain_new(), conn, server);
a_Capi_ccc(OpStart, 1, BCK, a_Chain_new(), conn, server);
@@ -497,7 +498,7 @@ int a_Capi_dpi_send_cmd(DilloUrl *url, void *bw, char *cmd, char *server,
conn = Capi_conn_find(server);
if (conn) {
/* found */
- dbuf = a_Chain_dbuf_new(cmd, (int)strlen(cmd), 0);
+ dbuf = a_Chain_dbuf_new(data, data_sz, 0);
a_Capi_ccc(OpSend, 1, BCK, conn->InfoSend, dbuf, NULL);
dFree(dbuf);
} else {
@@ -509,6 +510,16 @@ int a_Capi_dpi_send_cmd(DilloUrl *url, void *bw, char *cmd, char *server,
}
/*
+ * Send a dpi cmd.
+ * (For instance: add_bookmark, open_url, send_preferences, ...)
+ */
+int a_Capi_dpi_send_cmd(DilloUrl *url, void *bw, char *cmd, char *server,
+ int flags)
+{
+ return a_Capi_dpi_send_data(url, bw, cmd, strlen(cmd), server, flags);
+}
+
+/*
* Remove a client from the cache client queue.
* force = also abort the CCC if this is the last client.
*/