aboutsummaryrefslogtreecommitdiffstats
path: root/assuan/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
commitf8c8ca26d4608b1e1543e8b7ca7293c4473a7e7d (patch)
tree8ae5fab07a2fc8e4903fe0874c458e9a1c554351 /assuan/assuan-client.c
parent* server.c (option_handler): Allow to use -2 for "send all certs (diff)
downloadgnupg-f8c8ca26d4608b1e1543e8b7ca7293c4473a7e7d.tar.gz
gnupg-f8c8ca26d4608b1e1543e8b7ca7293c4473a7e7d.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 'assuan/assuan-client.c')
-rw-r--r--assuan/assuan-client.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/assuan/assuan-client.c b/assuan/assuan-client.c
index d56357dc6..41984fdac 100644
--- a/assuan/assuan-client.c
+++ b/assuan/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;
}