X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Futil.cpp;h=81a27f01d7c599d9fa9b33edc43f72d44a0728fb;hb=8ced8e7b5de3ecba12ac68ce5c5e8cddf40d800f;hp=245bf479977911f92778b7b60b01d5b2ae88c7a7;hpb=73f37c91c144b070020df2f27472c09b62367acf;p=metaproxy-moved-to-github.git diff --git a/src/util.cpp b/src/util.cpp index 245bf47..81a27f0 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1,5 +1,5 @@ /* This file is part of Metaproxy. - Copyright (C) 2005-2012 Index Data + Copyright (C) 2005-2013 Index Data Metaproxy is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -316,33 +316,11 @@ void mp_util::get_default_diag(Z_DefaultDiagFormat *r, void mp_util::get_init_diagnostics( Z_InitResponse *initrs, int &error_code, std::string &addinfo) { - Z_External *uif = initrs->userInformationField; - if (uif && uif->which == Z_External_userInfo1) - { - Z_OtherInformation *ui = uif->u.userInfo1; - int i; - for (i = 0; i < ui->num_elements; i++) - { - Z_OtherInformationUnit *unit = ui->list[i]; - if (unit->which == Z_OtherInfo_externallyDefinedInfo && - unit->information.externallyDefinedInfo && - unit->information.externallyDefinedInfo->which == - Z_External_diag1) - { - Z_DiagnosticFormat *diag = - unit->information.externallyDefinedInfo->u.diag1; - - if (diag->num > 0) - { - Z_DiagnosticFormat_s *ds = diag->elements[0]; - if (ds->which == Z_DiagnosticFormat_s_defaultDiagRec) - mp::util::get_default_diag(ds->u.defaultDiagRec, - error_code, addinfo); - } - } - } - } + Z_DefaultDiagFormat *df = yaz_decode_init_diag(0, initrs); + + if (df) + get_default_diag(df, error_code, addinfo); } int mp_util::get_or_remove_vhost_otherinfo(