aboutsummaryrefslogtreecommitdiffstats
path: root/src/assuan-client.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2002-02-28 11:05:57 +0000
committerWerner Koch <[email protected]>2002-02-28 11:05:57 +0000
commit52d4471e755e1e64c30ac2443cc5b3723241a14e (patch)
tree99955036a9782b8b278fe928752907e7de10d0a0 /src/assuan-client.c
parentA bunch of new features. Allow empty responses on an inquiry. (diff)
downloadlibassuan-52d4471e755e1e64c30ac2443cc5b3723241a14e.tar.gz
libassuan-52d4471e755e1e64c30ac2443cc5b3723241a14e.zip
* assuan-client.c (assuan_transact): Add 2 more arguments to
support status lines. Passing NULL yields the old behaviour. * assuan-handler.c (process_request): Flush data lines send without using the data fp.
Diffstat (limited to 'src/assuan-client.c')
-rw-r--r--src/assuan-client.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/assuan-client.c b/src/assuan-client.c
index d56357d..41984fd 100644
--- a/src/assuan-client.c
+++ b/src/assuan-client.c
@@ -57,6 +57,15 @@ _assuan_read_from_server (ASSUAN_CONTEXT ctx, int *okay, int *off)
*okay = 2; /* data line */
*off = 2;
}
+ else if (linelen >= 1
+ && line[0] == 'S'
+ && (line[1] == '\0' || line[1] == ' '))
+ {
+ *okay = 4;
+ *off = 1;
+ while (line[*off] == ' ')
+ ++*off;
+ }
else if (linelen >= 2
&& line[0] == 'O' && line[1] == 'K'
&& (line[2] == '\0' || line[2] == ' '))
@@ -101,6 +110,8 @@ _assuan_read_from_server (ASSUAN_CONTEXT ctx, int *okay, int *off)
* @data_cb_arg: first argument passed to @data_cb
* @inquire_cb: Callback function for a inquire response
* @inquire_cb_arg: first argument passed to @inquire_cb
+ * @status_cb: Callback function for a status response
+ * @status_cb_arg: first argument passed to @status_cb
*
* FIXME: Write documentation
*
@@ -114,7 +125,9 @@ assuan_transact (ASSUAN_CONTEXT ctx,
AssuanError (*data_cb)(void *, const void *, size_t),
void *data_cb_arg,
AssuanError (*inquire_cb)(void*, const char *),
- void *inquire_cb_arg)
+ void *inquire_cb_arg,
+ AssuanError (*status_cb)(void*, const char *),
+ void *status_cb_arg)
{
int rc, okay, off;
unsigned char *line;
@@ -181,6 +194,13 @@ assuan_transact (ASSUAN_CONTEXT ctx,
goto again;
}
}
+ else if (okay == 4)
+ {
+ if (status_cb)
+ rc = status_cb (status_cb_arg, line);
+ if (!rc)
+ goto again;
+ }
return rc;
}