From 9a0ef8e145b24face774ac8a90c770fd44c8fe16 Mon Sep 17 00:00:00 2001 From: fredrik Date: Thu, 12 Apr 2007 01:00:59 +0000 Subject: [PATCH] Add dc_checkprotocol. git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/doldaconnect@920 959494ce-11ee-0310-bf91-de5d638817bd --- lib/uilib.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/uilib.c b/lib/uilib.c index 65215b7..dbc13d1 100644 --- a/lib/uilib.c +++ b/lib/uilib.c @@ -1225,6 +1225,24 @@ void dc_freeires(struct dc_intresp *ires) free(ires); } +int dc_checkprotocol(struct dc_response *resp, int revision) +{ + struct dc_intresp *ires; + int low, high; + + if(resp->code != 201) + return(-1); + resp->curline = 0; + if((ires = dc_interpret(resp)) == NULL) + return(-1); + low = ires->argv[0].val.num; + high = ires->argv[0].val.num; + dc_freeires(ires); + if((revision < low) || (revision > high)) + return(-1); + return(0); +} + const char *dc_gethostname(void) { return(servinfo.hostname); -- 2.11.0