From: fredrik Date: Thu, 12 Apr 2007 01:00:59 +0000 (+0000) Subject: Add dc_checkprotocol. X-Git-Tag: 0.3~17 X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;ds=sidebyside;h=9a0ef8e145b24face774ac8a90c770fd44c8fe16;p=doldaconnect.git Add dc_checkprotocol. git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/doldaconnect@920 959494ce-11ee-0310-bf91-de5d638817bd --- 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);