示例#1
0
bool CMsnProto::MSN_StoreCreateRelationships(bool allowRecurse)
{
    char* reqHdr;
    ezxml_t tbdy;
    ezxml_t xmlp = storeSoapHdr("CreateRelationships", "RoamingIdentityChanged", tbdy, reqHdr);

    ezxml_t rels = ezxml_add_child(tbdy, "relationships", 0);
    ezxml_t rel = ezxml_add_child(rels, "Relationship", 0);
    ezxml_t node = ezxml_add_child(rel, "SourceID", 0);
    ezxml_set_txt(node, expresid);
    node = ezxml_add_child(rel, "SourceType", 0);
    ezxml_set_txt(node, "SubProfile");
    node = ezxml_add_child(rel, "TargetID", 0);
    ezxml_set_txt(node, photoid);
    node = ezxml_add_child(rel, "TargetType", 0);
    ezxml_set_txt(node, "Photo");
    node = ezxml_add_child(rel, "RelationshipName", 0);
    ezxml_set_txt(node, "ProfilePhoto");

    char* szData = ezxml_toxml(xmlp, true);

    ezxml_free(xmlp);

    unsigned status = 0;
    char *storeUrl = NULL, *tResult = NULL;

    for (int k = 4; --k;)
    {
        mir_free(storeUrl);
        storeUrl = GetStoreHost("CreateRelationships");
        tResult = getSslResult(&storeUrl, szData, reqHdr, status);
        if (tResult == NULL) UpdateStoreHost("CreateRelationships", NULL);
        else break;
    }

    mir_free(reqHdr);
    free(szData);

    if (tResult != NULL)
    {
        UpdateStoreHost("CreateRelationships", storeUrl);

        if (status == 500)
        {
            ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult));
            const char* szErr = ezxml_txt(getSoapFault(xmlm, true));
            if (strcmp(szErr, "PassportAuthFail") == 0 && allowRecurse)
            {
                MSN_GetPassportAuth();
                status = MSN_StoreCreateRelationships(false) ? 200 : 500;
            }
            ezxml_free(xmlm);
        }
    }

    mir_free(tResult);
    mir_free(storeUrl);

    return status == 200;
}
示例#2
0
ezxml_t CMsnProto::oimRecvHdr(const char* service, ezxml_t& tbdy, char*& httphdr)
{
	ezxml_t xmlp = ezxml_new("soap:Envelope");
	ezxml_set_attr(xmlp, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
	ezxml_set_attr(xmlp, "xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
	ezxml_set_attr(xmlp, "xmlns:soap", "http://schemas.xmlsoap.org/soap/envelope/");

	ezxml_t hdr = ezxml_add_child(xmlp, "soap:Header", 0);
	ezxml_t cook = ezxml_add_child(hdr, "PassportCookie", 0);
	ezxml_set_attr(cook, "xmlns", "http://www.hotmail.msn.com/ws/2004/09/oim/rsi");
	ezxml_t tcook = ezxml_add_child(cook, "t", 0);
	ezxml_set_txt(tcook, tAuthToken ? tAuthToken : "");
	ezxml_t pcook = ezxml_add_child(cook, "p", 0);
	ezxml_set_txt(pcook, pAuthToken ? pAuthToken : "");

	ezxml_t bdy = ezxml_add_child(xmlp, "soap:Body", 0);

	tbdy = ezxml_add_child(bdy, service, 0);
	ezxml_set_attr(tbdy, "xmlns", "http://www.hotmail.msn.com/ws/2004/09/oim/rsi");

	size_t hdrsz = mir_strlen(service) + sizeof(mailReqHdr) + 20;
	httphdr = (char*)mir_alloc(hdrsz);

	mir_snprintf(httphdr, hdrsz, mailReqHdr, service);

	return xmlp;
}
示例#3
0
bool CMsnProto::MSN_StoreCreateProfile(bool allowRecurse)
{
    char* reqHdr;
    ezxml_t tbdy;
    ezxml_t xmlp = storeSoapHdr("CreateProfile", "RoamingSeed", tbdy, reqHdr);

    ezxml_t pro = ezxml_add_child(tbdy, "profile", 0);
    ezxml_t node;

    pro = ezxml_add_child(pro, "ExpressionProfile", 0);
    ezxml_add_child(pro, "PersonalStatus", 0);
    node = ezxml_add_child(pro, "RoleDefinitionName", 0);
    ezxml_set_txt(node, "ExpressionProfileDefault");

    char* szData = ezxml_toxml(xmlp, true);

    ezxml_free(xmlp);

    unsigned status = 0;
    char *storeUrl, *tResult = NULL;

    storeUrl = mir_strdup("https://storage.msn.com/storageservice/SchematizedStore.asmx");
    tResult = getSslResult(&storeUrl, szData, reqHdr, status);

    mir_free(reqHdr);
    free(szData);

    if (tResult != NULL)
    {
        if (status == 200)
        {
            ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult));
            UpdateStoreCacheKey(xmlm);
            ezxml_t body = getSoapResponse(xmlm, "CreateProfile");

            MSN_StoreShareItem(ezxml_txt(body));
            MSN_SharingMyProfile();

            ezxml_free(xmlm);
        }
        else if (status == 500)
        {
            ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult));
            const char* szErr = ezxml_txt(getSoapFault(xmlm, true));
            if (strcmp(szErr, "PassportAuthFail") == 0 && allowRecurse)
            {
                MSN_GetPassportAuth();
                status = MSN_StoreCreateProfile(false) ? 200 : 500;
            }
            ezxml_free(xmlm);
        }
    }

    mir_free(tResult);
    mir_free(storeUrl);

    return status == 200;
}
示例#4
0
static ezxml_t _wmts_service_contact(mapcache_context *ctx, mapcache_cfg *cfg)
{
  const char *value;

  ezxml_t node = ezxml_new("ows:ServiceContact");

  value = apr_table_get(cfg->metadata,"contactname");
  if(value)
    ezxml_set_txt(ezxml_add_child(node,"ows:IndividualName",0),value);

  value = apr_table_get(cfg->metadata,"contactposition");
  if(value)
    ezxml_set_txt(ezxml_add_child(node,"ows:PositionName",0),value);

  ezxml_insert(_wmts_service_contactinfo(ctx,cfg),node,0);

  return node;
}
示例#5
0
文件: xml.c 项目: FauxFaux/despotify
/* Generate a tag with escaped character content. */
char* xml_gen_tag(char* name, char* content)
{
    ezxml_t tag = ezxml_new(name);
    ezxml_set_txt(tag, content);
    char* ret = ezxml_toxml(tag);
    ezxml_free(tag);

    return ret;
}
示例#6
0
ezxml_t CMsnProto::storeSoapHdr(const char* service, const char* scenario, ezxml_t& tbdy, char*& httphdr)
{
    ezxml_t xmlp = ezxml_new("soap:Envelope");
    ezxml_set_attr(xmlp, "xmlns:soap", "http://schemas.xmlsoap.org/soap/envelope/");
    ezxml_set_attr(xmlp, "xmlns:xsi",  "http://www.w3.org/2001/XMLSchema-instance");
    ezxml_set_attr(xmlp, "xmlns:xsd",  "http://www.w3.org/2001/XMLSchema");
    ezxml_set_attr(xmlp, "xmlns:soapenc", "http://schemas.xmlsoap.org/soap/encoding/");

    ezxml_t hdr = ezxml_add_child(xmlp, "soap:Header", 0);

    if (storageCacheKey)
    {
        ezxml_t cachehdr = ezxml_add_child(hdr, "AffinityCacheHeader", 0);
        ezxml_set_attr(cachehdr, "xmlns", "http://www.msn.com/webservices/storage/2008");
        ezxml_t node = ezxml_add_child(cachehdr, "CacheKey", 0);
        ezxml_set_txt(node, storageCacheKey);
    }

    ezxml_t apphdr = ezxml_add_child(hdr, "StorageApplicationHeader", 0);
    ezxml_set_attr(apphdr, "xmlns", "http://www.msn.com/webservices/storage/2008");
    ezxml_t node = ezxml_add_child(apphdr, "ApplicationID", 0);
    ezxml_set_txt(node, "Messenger Client 9.0");
    node = ezxml_add_child(apphdr, "Scenario", 0);
    ezxml_set_txt(node, scenario);

    ezxml_t authhdr = ezxml_add_child(hdr, "StorageUserHeader", 0);
    ezxml_set_attr(authhdr, "xmlns", "http://www.msn.com/webservices/storage/2008");
    node = ezxml_add_child(authhdr, "Puid", 0);
    ezxml_set_txt(node, mypuid);
    node = ezxml_add_child(authhdr, "TicketToken", 0);
    if (authStorageToken) ezxml_set_txt(node, authStorageToken);

    ezxml_t bdy = ezxml_add_child(xmlp, "soap:Body", 0);

    tbdy = ezxml_add_child(bdy, service, 0);
    ezxml_set_attr(tbdy, "xmlns", "http://www.msn.com/webservices/storage/2008");

    size_t hdrsz = strlen(service) + sizeof(storeReqHdr) + 20;
    httphdr = (char*)mir_alloc(hdrsz);

    mir_snprintf(httphdr, hdrsz, storeReqHdr, service);

    return xmlp;
}
示例#7
0
bool CMsnProto::MSN_StoreShareItem(const char* id, bool allowRecurse)
{
    char* reqHdr;
    ezxml_t tbdy;
    ezxml_t xmlp = storeSoapHdr("ShareItem", "RoamingSeed", tbdy, reqHdr);

    ezxml_t node = ezxml_add_child(tbdy, "resourceID", 0);
    ezxml_set_txt(node, id);
    node = ezxml_add_child(tbdy, "displayName", 0);
    ezxml_set_txt(node, "Messenger Roaming Identity");

    char* szData = ezxml_toxml(xmlp, true);

    ezxml_free(xmlp);

    unsigned status = 0;
    char *storeUrl, *tResult = NULL;

    storeUrl = mir_strdup("https://storage.msn.com/storageservice/SchematizedStore.asmx");
    tResult = getSslResult(&storeUrl, szData, reqHdr, status);

    mir_free(reqHdr);
    free(szData);

    if (tResult != NULL && status == 500)
    {
        ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult));
        const char* szErr = ezxml_txt(getSoapFault(xmlm, true));
        if (strcmp(szErr, "PassportAuthFail") == 0 && allowRecurse)
        {
            MSN_GetPassportAuth();
            status = MSN_StoreCreateProfile(false) ? 200 : 500;
        }
        ezxml_free(xmlm);
    }

    mir_free(tResult);
    mir_free(storeUrl);

    return status == 200;
}
示例#8
0
static ezxml_t _wmts_inspire_metadata(mapcache_context *ctx, mapcache_cfg *cfg)
{
  ezxml_t extended = ezxml_new("inspire_vs:ExtendedCapabilities");
  ezxml_t metadata;
  ezxml_t metadataurl;
  ezxml_t metadatatype;
  ezxml_t langsupported;
  ezxml_t langsupporteddefault;
  ezxml_t langsupporteddefaultlang;
  ezxml_t langresponse;
  const char *value;

  metadata = ezxml_add_child(extended,"inspire_common:MetadataUrl",0);
  ezxml_set_attr(metadata,"xsi:type","inspire_common:resourceLocatorType");
  metadataurl = ezxml_add_child(metadata, "inspire_common:URL", 0);

  value = apr_table_get(cfg->metadata, "inspire_metadataurl");
  if(value)
    ezxml_set_txt(metadataurl, value);
 
  metadatatype = ezxml_add_child(metadata, "inspire_common:MediaType", 0);
  ezxml_set_txt(metadatatype, "application/vnd.iso.19139+xml");

  langsupported = ezxml_add_child(extended, "inspire_common:SupportedLanguages", 0);
  langsupporteddefault = ezxml_add_child(langsupported, "inspire_common:DefaultLanguage", 0);
  langsupporteddefaultlang = ezxml_add_child(langsupporteddefault, "inspire_common:Language", 0);

  value = apr_table_get(cfg->metadata, "defaultlanguage");
  if(value)
    ezxml_set_txt(langsupporteddefaultlang, apr_table_get(cfg->metadata, "defaultlanguage"));

  langresponse = ezxml_add_child(extended, "inspire_common:ResponseLanguage", 0);
  apr_table_do(_wmts_inspire_metadata_responselanguages, langresponse, cfg->metadata, "language", NULL);

  return extended;
}
示例#9
0
static ezxml_t _wmts_service_provider(mapcache_context *ctx, mapcache_cfg *cfg)
{
  const char *value;

  ezxml_t node = ezxml_new("ows:ServiceProvider");

  value = apr_table_get(cfg->metadata,"providername");
  if(value)
    ezxml_set_txt(ezxml_add_child(node,"ows:ProviderName",0),value);

  value = apr_table_get(cfg->metadata,"providerurl");
  if(value)
    ezxml_set_attr(ezxml_add_child(node,"ows:ProviderSite",0),"xlink:href",value);

  ezxml_insert(_wmts_service_contact(ctx,cfg),node,0);

  return node;
}
示例#10
0
static ezxml_t _wmts_operations_metadata(mapcache_context *ctx, const char *onlineresource, const char *operationstr)
{
  ezxml_t http;
  ezxml_t dcp;
  ezxml_t get;
  ezxml_t constraint;
  ezxml_t allowedvalues;
  ezxml_t operation = ezxml_new("ows:Operation");
  ezxml_set_attr(operation,"name",operationstr);
  dcp = ezxml_add_child(operation,"ows:DCP",0);
  http = ezxml_add_child(dcp,"ows:HTTP",0);
  get = ezxml_add_child(http,"ows:Get",0);
  ezxml_set_attr(get,"xlink:href",apr_pstrcat(ctx->pool,onlineresource,"wmts?",NULL));
  constraint = ezxml_add_child(get,"ows:Constraint",0);
  ezxml_set_attr(constraint,"name","GetEncoding");
  allowedvalues = ezxml_add_child(constraint,"ows:AllowedValues",0);
  ezxml_set_txt(ezxml_add_child(allowedvalues,"ows:Value",0),"KVP");
  return operation;

}
示例#11
0
static ezxml_t _wmts_service_identification(mapcache_context *ctx, mapcache_cfg *cfg)
{
  const char *value;

  ezxml_t node = ezxml_new("ows:ServiceIdentification");

  value = apr_table_get(cfg->metadata,"title");
  if(value)
    ezxml_set_txt(ezxml_add_child(node,"ows:Title",0),value);

  value = apr_table_get(cfg->metadata,"abstract");
  if(value)
    ezxml_set_txt(ezxml_add_child(node,"ows:Abstract",0),value);

  value = apr_table_get(cfg->metadata,"keyword");
  if(value) {
    ezxml_t nodeKeywords = ezxml_new("ows:Keywords");
    /*
     * @todo: cfg->metadata holds only one item named keyword,
     *    adjust configuration_xml.c
     */
    apr_table_do(_wmts_service_identification_keywords, nodeKeywords, cfg->metadata, "keyword", NULL);
    ezxml_insert(nodeKeywords, node, 0);
  }

  ezxml_set_txt(ezxml_add_child(node,"ows:ServiceType",0),"OGC WMTS");
  ezxml_set_txt(ezxml_add_child(node,"ows:ServiceTypeVersion",0),"1.0.0");

  value = apr_table_get(cfg->metadata,"fees");
  if(value)
    ezxml_set_txt(ezxml_add_child(node,"ows:Fees",0),value);

  value = apr_table_get(cfg->metadata,"accessconstraints");
  if(value)
    ezxml_set_txt(ezxml_add_child(node,"ows:AccessConstraints",0),value);

  return node;
}
示例#12
0
bool CMsnProto::MSN_StoreFindDocuments(bool allowRecurse)
{
    char* reqHdr;
    ezxml_t tbdy;
    ezxml_t xmlp = storeSoapHdr("FindDocuments", "RoamingIdentityChanged", tbdy, reqHdr);

    ezxml_t srch = ezxml_add_child(tbdy, "objectHandle", 0);
    ezxml_t node = ezxml_add_child(srch, "RelationshipName", 0);
    ezxml_set_txt(node, "/UserTiles");

    ezxml_t alias = ezxml_add_child(srch, "Alias", 0);
    node = ezxml_add_child(alias, "Name", 0);
    ezxml_set_txt(node, mycid);
    node = ezxml_add_child(alias, "NameSpace", 0);
    ezxml_set_txt(node, "MyCidStuff");

    ezxml_t doc = ezxml_add_child(tbdy, "documentAttributes", 0);
    node = ezxml_add_child(doc, "ResourceID", 0);
    ezxml_set_txt(node, "true");
    node = ezxml_add_child(doc, "Name", 0);
    ezxml_set_txt(node, "true");

    doc = ezxml_add_child(tbdy, "documentFilter", 0);
    node = ezxml_add_child(doc, "FilterAttributes", 0);
    ezxml_set_txt(node, "None");

    doc = ezxml_add_child(tbdy, "documentSort", 0);
    node = ezxml_add_child(doc, "SortBy", 0);
    ezxml_set_txt(node, "DateModified");

    doc = ezxml_add_child(tbdy, "findContext", 0);
    node = ezxml_add_child(doc, "FindMethod", 0);
    ezxml_set_txt(node, "Default");
    node = ezxml_add_child(doc, "ChunkSize", 0);
    ezxml_set_txt(node, "25");

    char* szData = ezxml_toxml(xmlp, true);

    ezxml_free(xmlp);

    unsigned status = 0;
    char *storeUrl = NULL, *tResult = NULL;

    for (int k = 4; --k;)
    {
        mir_free(storeUrl);
        storeUrl = GetStoreHost("FindDocuments");
        tResult = getSslResult(&storeUrl, szData, reqHdr, status);
        if (tResult == NULL) UpdateStoreHost("FindDocuments", NULL);
        else break;
    }

    mir_free(reqHdr);
    free(szData);

    if (tResult != NULL)
    {
        UpdateStoreHost("FindDocuments", storeUrl);
        if (status == 500)
        {
            ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult));
            const char* szErr = ezxml_txt(getSoapFault(xmlm, true));
            if (strcmp(szErr, "PassportAuthFail") == 0 && allowRecurse)
            {
                MSN_GetPassportAuth();
                status = MSN_StoreFindDocuments(false) ? 200 : 500;
            }
            ezxml_free(xmlm);
        }
    }

    mir_free(tResult);
    mir_free(storeUrl);

    return status == 200;
}
示例#13
0
bool CMsnProto::MSN_StoreUpdateDocument(const TCHAR *sztName, const char *szMimeType, const char *szPicData, bool allowRecurse)
{
    char* reqHdr;
    char* szName = mir_utf8encodeT(sztName);
    ezxml_t tbdy;
    ezxml_t xmlp = storeSoapHdr("UpdateDocument", "RoamingIdentityChanged", tbdy, reqHdr);

    ezxml_t doc = ezxml_add_child(tbdy, "document", 0);
    ezxml_set_attr(doc, "xsi:type", "Photo");
    ezxml_t node = ezxml_add_child(doc, "ResourceID", 0);
    ezxml_set_txt(node, photoid);
    node = ezxml_add_child(doc, "Name", 0);
    ezxml_set_txt(node, szName);

    doc = ezxml_add_child(doc, "DocumentStreams", 0);
    doc = ezxml_add_child(doc, "DocumentStream", 0);
    ezxml_set_attr(doc, "xsi:type", "PhotoStream");

    node = ezxml_add_child(doc, "MimeType", 0);
    ezxml_set_txt(node, szMimeType);
    node = ezxml_add_child(doc, "Data", 0);
    ezxml_set_txt(node, szPicData);
    node = ezxml_add_child(doc, "DataSize", 0);
    ezxml_set_txt(node, "0");
    node = ezxml_add_child(doc, "DocumentStreamType", 0);
    ezxml_set_txt(node, "UserTileStatic");

    char* szData = ezxml_toxml(xmlp, true);

    ezxml_free(xmlp);
    mir_free(szName);

    unsigned status = 0;
    char *storeUrl = NULL, *tResult = NULL;

    for (int k = 4; --k;)
    {
        mir_free(storeUrl);
        storeUrl = GetStoreHost("UpdateDocument");
        tResult = getSslResult(&storeUrl, szData, reqHdr, status);
        if (tResult == NULL) UpdateStoreHost("UpdateDocument", NULL);
        else break;
    }

    mir_free(reqHdr);
    free(szData);

    if (tResult != NULL)
    {
        UpdateStoreHost("UpdateDocument", storeUrl);
        if (status == 500 && allowRecurse)
        {
            ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult));
            const char* szErr = ezxml_txt(getSoapFault(xmlm, true));
            if (strcmp(szErr, "PassportAuthFail") == 0)
            {
                MSN_GetPassportAuth();
                status = MSN_StoreUpdateDocument(sztName, szMimeType, szPicData, false) ? 200 : 500;
            }
            else if (szErr[0])
            {
                MSN_StoreDeleteRelationships(true);
                MSN_StoreDeleteRelationships(false);

                MSN_StoreCreateDocument(sztName, szMimeType, szPicData);
                MSN_StoreCreateRelationships();
            }
            ezxml_free(xmlm);
        }
    }

    mir_free(tResult);
    mir_free(storeUrl);

    return status == 200;
}
示例#14
0
bool CMsnProto::MSN_StoreCreateDocument(const TCHAR *sztName, const char *szMimeType, const char *szPicData, bool allowRecurse)
{
    char* reqHdr;
    ezxml_t tbdy;
    char* szName = mir_utf8encodeT(sztName);
    ezxml_t xmlp = storeSoapHdr("CreateDocument", "RoamingIdentityChanged", tbdy, reqHdr);

    ezxml_t hndl = ezxml_add_child(tbdy, "parentHandle", 0);
    ezxml_t node = ezxml_add_child(hndl, "RelationshipName", 0);
    ezxml_set_txt(node, "/UserTiles");

    ezxml_t alias = ezxml_add_child(hndl, "Alias", 0);
    node = ezxml_add_child(alias, "Name", 0);
    ezxml_set_txt(node, mycid);
    node = ezxml_add_child(alias, "NameSpace", 0);
    ezxml_set_txt(node, "MyCidStuff");

    ezxml_t doc = ezxml_add_child(tbdy, "document", 0);
    ezxml_set_attr(doc, "xsi:type", "Photo");
    node = ezxml_add_child(doc, "Name", 0);
    ezxml_set_txt(node, szName);

    doc = ezxml_add_child(doc, "DocumentStreams", 0);
    doc = ezxml_add_child(doc, "DocumentStream", 0);
    ezxml_set_attr(doc, "xsi:type", "PhotoStream");
    node = ezxml_add_child(doc, "DocumentStreamType", 0);

    ezxml_set_txt(node, "UserTileStatic");
    node = ezxml_add_child(doc, "MimeType", 0);
    ezxml_set_txt(node, szMimeType);
    node = ezxml_add_child(doc, "Data", 0);
    ezxml_set_txt(node, szPicData);
    node = ezxml_add_child(doc, "DataSize", 0);
    ezxml_set_txt(node, "0");

    node = ezxml_add_child(tbdy, "relationshipName", 0);
    ezxml_set_txt(node, "Messenger User Tile");

    char* szData = ezxml_toxml(xmlp, true);

    ezxml_free(xmlp);
    mir_free(szName);

    unsigned status = 0;
    char *storeUrl = NULL, *tResult = NULL;

    for (int k = 4; --k;)
    {
        mir_free(storeUrl);
        storeUrl = GetStoreHost("CreateDocument");
        tResult = getSslResult(&storeUrl, szData, reqHdr, status);
        if (tResult == NULL) UpdateStoreHost("CreateDocument", NULL);
        else break;
    }

    mir_free(reqHdr);
    free(szData);

    if (tResult != NULL)
    {
        UpdateStoreHost("CreateDocument", storeUrl);
        if (status == 200)
        {
            ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult));
            ezxml_t bdy = getSoapResponse(xmlm, "CreateDocument");
            mir_snprintf(photoid, sizeof(photoid), "%s", ezxml_txt(bdy));
            ezxml_free(xmlm);
        }
        else if (status == 500)
        {
            ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult));
            const char* szErr = ezxml_txt(getSoapFault(xmlm, true));
            if (strcmp(szErr, "PassportAuthFail") == 0 && allowRecurse)
            {
                MSN_GetPassportAuth();
                status = MSN_StoreCreateDocument(sztName, szMimeType, szPicData, false) ? 200 : 500;
            }
            ezxml_free(xmlm);
        }
    }

    mir_free(tResult);
    mir_free(storeUrl);

    return status == 200;
}
示例#15
0
bool CMsnProto::MSN_StoreDeleteRelationships(bool tile, bool allowRecurse)
{
    char* reqHdr;
    ezxml_t tbdy;
    ezxml_t xmlp = storeSoapHdr("DeleteRelationships", "RoamingIdentityChanged", tbdy, reqHdr);

    ezxml_t srch = ezxml_add_child(tbdy, "sourceHandle", 0);

    ezxml_t node;
    if (tile)
    {
        node = ezxml_add_child(srch, "RelationshipName", 0);
        ezxml_set_txt(node, "/UserTiles");

        ezxml_t alias = ezxml_add_child(srch, "Alias", 0);
        node = ezxml_add_child(alias, "Name", 0);
        ezxml_set_txt(node, mycid);
        node = ezxml_add_child(alias, "NameSpace", 0);
        ezxml_set_txt(node, "MyCidStuff");
    }
    else
    {
        node = ezxml_add_child(srch, "ResourceID", 0);
        ezxml_set_txt(node, expresid);
    }

    node = ezxml_add_child(tbdy, "targetHandles", 0);
    node = ezxml_add_child(node, "ObjectHandle", 0);
    node = ezxml_add_child(node, "ResourceID", 0);
    ezxml_set_txt(node, photoid);

    char* szData = ezxml_toxml(xmlp, true);

    ezxml_free(xmlp);

    unsigned status = 0;
    char *storeUrl = NULL, *tResult = NULL;

    for (int k = 4; --k;)
    {
        mir_free(storeUrl);
        storeUrl = GetStoreHost("DeleteRelationships");
        tResult = getSslResult(&storeUrl, szData, reqHdr, status);
        if (tResult == NULL) UpdateStoreHost("DeleteRelationships", NULL);
        else break;
    }

    mir_free(reqHdr);
    free(szData);

    if (tResult != NULL)
    {
        UpdateStoreHost("DeleteRelationships", storeUrl);
        if (status == 500)
        {
            ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult));
            const char* szErr = ezxml_txt(getSoapFault(xmlm, true));
            if (strcmp(szErr, "PassportAuthFail") == 0 && allowRecurse)
            {
                MSN_GetPassportAuth();
                status = MSN_StoreDeleteRelationships(tile, false) ? 200 : 500;
            }
            ezxml_free(xmlm);
        }
    }

    mir_free(tResult);
    mir_free(storeUrl);

    return status == 200;
}
示例#16
0
static ezxml_t _wmts_service_contactinfo(mapcache_context *ctx, mapcache_cfg *cfg)
{
  const char *value;
  int addNode = 0;
  ezxml_t nodeAddress;

  ezxml_t nodeInfo = ezxml_new("ows:ContactInfo");
  ezxml_t nodePhone = ezxml_new("ows:Phone");

  value = apr_table_get(cfg->metadata,"contactphone"); 
  if(value) {
    addNode = 1;
    ezxml_set_txt(ezxml_add_child(nodePhone,"ows:Voice",0),value);
  }

  value = apr_table_get(cfg->metadata,"contactfacsimile"); 
  if(value) {
    addNode = 1;
    ezxml_set_txt(ezxml_add_child(nodePhone,"ows:Facsimile",0),value);
  }

  if( addNode == 1 )
    ezxml_insert(nodePhone, nodeInfo, 0);


  addNode = 0;
  nodeAddress = ezxml_new("ows:Address");
  
  value = apr_table_get(cfg->metadata,"contactorganization");
  if(value) {
    addNode = 1;
    ezxml_set_txt(ezxml_add_child(nodeAddress,"ows:DeliveryPoint",0),value);
  }

  value = apr_table_get(cfg->metadata,"contactcity");
  if(value) {
    addNode = 1;
    ezxml_set_txt(ezxml_add_child(nodeAddress,"ows:City",0),value);
  }

  value = apr_table_get(cfg->metadata,"contactstateorprovince");
  if(value) {
    addNode = 1;
    ezxml_set_txt(ezxml_add_child(nodeAddress,"ows:AdministrativeArea",0),value);
  }

  value = apr_table_get(cfg->metadata,"contactpostcode");
  if(value) {
    addNode = 1;
    ezxml_set_txt(ezxml_add_child(nodeAddress,"ows:PostalCode",0),value);
  }

  value = apr_table_get(cfg->metadata,"contactcountry");
  if(value) {
    addNode = 1;
    ezxml_set_txt(ezxml_add_child(nodeAddress,"ows:Country",0),value);
  }

  value = apr_table_get(cfg->metadata,"contactelectronicmailaddress");
  if(value) {
    addNode = 1;
    ezxml_set_txt(ezxml_add_child(nodeAddress,"ows:ElectronicMailAddress",0),value);
  }

  if( addNode == 1 )
    ezxml_insert(nodeAddress, nodeInfo, 0);

  return nodeInfo;
}
示例#17
0
void _create_capabilities_wms(mapcache_context *ctx, mapcache_request_get_capabilities *req, char *guessed_url, char *path_info, mapcache_cfg *cfg)
{
  ezxml_t caps, tmpxml;
  const char *title;
  const char *url;
  ezxml_t capxml;
  ezxml_t reqxml;
  ezxml_t vendorxml;
  ezxml_t toplayer;
  apr_hash_index_t *grid_index;
  apr_hash_index_t *tileindex_index;
  char *tmpcaps;
  static char *capheader;
  mapcache_request_get_capabilities_wms *request = (mapcache_request_get_capabilities_wms*)req;
#ifdef DEBUG
  if(request->request.request.type != MAPCACHE_REQUEST_GET_CAPABILITIES) {
    ctx->set_error(ctx,400,"wrong wms capabilities request");
    return;
  }
#endif

  url = apr_table_get(cfg->metadata,"url");
  if(!url) {
    url = guessed_url;
  }

  url = apr_pstrcat(ctx->pool,url,req->request.service->url_prefix,"?",NULL);
  caps = ezxml_new("WMT_MS_Capabilities");
  ezxml_set_attr(caps,"version","1.1.1");
  /*
            "<Service>\n"
              "<Name>OGC:WMS</Name>\n"
              "<Title>%s</Title>\n"
              "<OnlineResource xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"%s/wms?\"/>\n"
            "</Service>\n"
  */
  tmpxml = ezxml_add_child(caps,"Service",0);
  ezxml_set_txt(ezxml_add_child(tmpxml,"Name",0),"OGC:WMS");
  title = apr_table_get(cfg->metadata,"title");
  if(!title) {
    title = "no title set, add some in metadata";
  }
  ezxml_set_txt(ezxml_add_child(tmpxml,"Title",0),title);
  tmpxml = ezxml_add_child(tmpxml,"OnlineResource",0);
  ezxml_set_attr(tmpxml,"xmlns:xlink","http://www.w3.org/1999/xlink");
  ezxml_set_attr(tmpxml,"xlink:href",url);
  /*

     "<Capability>\n"
     "<Request>\n"
  */
  capxml = ezxml_add_child(caps,"Capability",0);
  reqxml = ezxml_add_child(capxml,"Request",0);
  /*
     "<GetCapabilities>\n"
     " <Format>application/vnd.ogc.wms_xml</Format>\n"
     " <DCPType>\n"
     "  <HTTP>\n"
     "   <Get><OnlineResource xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"%s/wms?\"/></Get>\n"
     "  </HTTP>\n"
     " </DCPType>\n"
     "</GetCapabilities>\n"
     */
  tmpxml = ezxml_add_child(reqxml,"GetCapabilities",0);
  ezxml_set_txt(ezxml_add_child(tmpxml,"Format",0),"application/vnd.ogc.wms_xml");
  tmpxml = ezxml_add_child(tmpxml,"DCPType",0);
  tmpxml = ezxml_add_child(tmpxml,"HTTP",0);
  tmpxml = ezxml_add_child(tmpxml,"Get",0);
  tmpxml = ezxml_add_child(tmpxml,"OnlineResource",0);
  ezxml_set_attr(tmpxml,"xmlns:xlink","http://www.w3.org/1999/xlink");
  ezxml_set_attr(tmpxml,"xlink:href",url);

  /*
                "<GetMap>\n"
                  "<Format>image/png</Format>\n"
                  "<Format>image/jpeg</Format>\n"
                  "<DCPType>\n"
                    "<HTTP>\n"
                      "<Get><OnlineResource xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"%s/wms?\"/></Get>\n"
                    "</HTTP>\n"
                  "</DCPType>\n"
                "</GetMap>\n"
  */
  tmpxml = ezxml_add_child(reqxml,"GetMap",0);
  ezxml_set_txt(ezxml_add_child(tmpxml,"Format",0),"image/png");
  ezxml_set_txt(ezxml_add_child(tmpxml,"Format",0),"image/jpeg");
  tmpxml = ezxml_add_child(tmpxml,"DCPType",0);
  tmpxml = ezxml_add_child(tmpxml,"HTTP",0);
  tmpxml = ezxml_add_child(tmpxml,"Get",0);
  tmpxml = ezxml_add_child(tmpxml,"OnlineResource",0);
  ezxml_set_attr(tmpxml,"xmlns:xlink","http://www.w3.org/1999/xlink");
  ezxml_set_attr(tmpxml,"xlink:href",url);


  /*
                "<GetFeatureInfo>\n"
                  "<Format>text/plain</Format>\n"
                  "<Format>application/vnd.ogc.gml</Format>\n"
                  "<DCPType>\n"
                    "<HTTP>\n"
                      "<Get>\n"
                        "<OnlineResource xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:type=\"simple\" xlink:href=\"%s/wms?\" />\n"
                      "</Get>\n"
                    "</HTTP>\n"
                  "</DCPType>\n"
                "</GetFeatureInfo>\n"
  */
  tmpxml = ezxml_add_child(reqxml,"GetFeatureInfo",0);
  ezxml_set_txt(ezxml_add_child(tmpxml,"Format",0),"text/plain");
  ezxml_set_txt(ezxml_add_child(tmpxml,"Format",0),"application/vnd.ogc.gml");
  tmpxml = ezxml_add_child(tmpxml,"DCPType",0);
  tmpxml = ezxml_add_child(tmpxml,"HTTP",0);
  tmpxml = ezxml_add_child(tmpxml,"Get",0);
  tmpxml = ezxml_add_child(tmpxml,"OnlineResource",0);
  ezxml_set_attr(tmpxml,"xmlns:xlink","http://www.w3.org/1999/xlink");
  ezxml_set_attr(tmpxml,"xlink:href",url);

  /*
              "<Exception>\n"
                "<Format>text/plain</Format>\n"
              "</Exception>\n"
  */

  tmpxml = ezxml_add_child(capxml,"Exceptions",0);
  ezxml_set_txt(ezxml_add_child(tmpxml,"Format",0),"text/plain");

  vendorxml = ezxml_add_child(capxml,"VendorSpecificCapabilities",0);
  toplayer = ezxml_add_child(capxml,"Layer",0);
  tmpxml = ezxml_add_child(toplayer,"Title",0);
  ezxml_set_txt(tmpxml,title);

  /*
   * announce all layer srs's in the root layer. This part of the wms spec we
   * cannot respect with a caching solution, as each tileset can only be served
   * under a specified number of projections.
   *
   * TODO: check for duplicates in gris srs
   */
  grid_index = apr_hash_first(ctx->pool,cfg->grids);
  while(grid_index) {
    const void *key;
    apr_ssize_t keylen;
    mapcache_grid *grid = NULL;
    apr_hash_this(grid_index,&key,&keylen,(void**)&grid);
    ezxml_set_txt(ezxml_add_child(toplayer,"SRS",0),grid->srs);
    grid_index = apr_hash_next(grid_index);
  }


  tileindex_index = apr_hash_first(ctx->pool,cfg->tilesets);

  while(tileindex_index) {
    mapcache_tileset *tileset;
    ezxml_t layerxml;
    ezxml_t tsxml;
    const void *key;
    apr_ssize_t keylen;
    const char *title;
    const char *abstract;
    int i;
    apr_hash_this(tileindex_index,&key,&keylen,(void**)&tileset);

    layerxml = ezxml_add_child(toplayer,"Layer",0);
    ezxml_set_attr(layerxml, "cascaded", "1");
    ezxml_set_attr(layerxml, "queryable", (tileset->source && tileset->source->info_formats)?"1":"0");
    
    ezxml_set_txt(ezxml_add_child(layerxml,"Name",0),tileset->name);
    tsxml = ezxml_add_child(vendorxml, "TileSet",0);

    /*optional layer title*/
    title = apr_table_get(tileset->metadata,"title");
    if(title) {
      ezxml_set_txt(ezxml_add_child(layerxml,"Title",0),title);
    } else {
      ezxml_set_txt(ezxml_add_child(layerxml,"Title",0),tileset->name);
    }

    /*optional layer abstract*/
    abstract = apr_table_get(tileset->metadata,"abstract");
    if(abstract) {
      ezxml_set_txt(ezxml_add_child(layerxml,"Abstract",0),abstract);
    }

    if(tileset->wgs84bbox.minx != tileset->wgs84bbox.maxx) {
      ezxml_t wgsxml = ezxml_add_child(layerxml,"LatLonBoundingBox",0);
      ezxml_set_attr(wgsxml,"minx",apr_psprintf(ctx->pool,"%f",tileset->wgs84bbox.minx));
      ezxml_set_attr(wgsxml,"miny",apr_psprintf(ctx->pool,"%f",tileset->wgs84bbox.miny));
      ezxml_set_attr(wgsxml,"maxx",apr_psprintf(ctx->pool,"%f",tileset->wgs84bbox.maxx));
      ezxml_set_attr(wgsxml,"maxy",apr_psprintf(ctx->pool,"%f",tileset->wgs84bbox.maxy));
    }

    if(tileset->dimensions) {
      for(i=0; i<tileset->dimensions->nelts; i++) {
        const char **value;
        char *dimval;
        mapcache_dimension *dimension = APR_ARRAY_IDX(tileset->dimensions,i,mapcache_dimension*);
        ezxml_t dimxml = ezxml_add_child(layerxml,"Dimension",0);
        ezxml_set_attr(dimxml,"name",dimension->name);
        ezxml_set_attr(dimxml,"default",dimension->default_value);

        if(dimension->unit) {
          ezxml_set_attr(dimxml,"units",dimension->unit);
        }
        value = dimension->print_ogc_formatted_values(ctx,dimension);
        dimval = apr_pstrdup(ctx->pool,*value);
        value++;
        while(*value) {
          dimval = apr_pstrcat(ctx->pool,dimval,",",*value,NULL);
          value++;
        }
        ezxml_set_txt(dimxml,dimval);
      }
    }


    for(i=0; i<tileset->grid_links->nelts; i++) {
      int j;
      ezxml_t bboxxml;
      mapcache_grid_link *gridlink = APR_ARRAY_IDX(tileset->grid_links,i,mapcache_grid_link*);
      mapcache_grid *grid = gridlink->grid;
      mapcache_extent *extent = &(grid->extent);
      if(gridlink->restricted_extent)
        extent = gridlink->restricted_extent;
      bboxxml = ezxml_add_child(layerxml,"BoundingBox",0);
      ezxml_set_attr(bboxxml,"SRS", grid->srs);
      ezxml_set_attr(bboxxml,"minx",apr_psprintf(ctx->pool,"%f",extent->minx));
      ezxml_set_attr(bboxxml,"miny",apr_psprintf(ctx->pool,"%f",extent->miny));
      ezxml_set_attr(bboxxml,"maxx",apr_psprintf(ctx->pool,"%f",extent->maxx));
      ezxml_set_attr(bboxxml,"maxy",apr_psprintf(ctx->pool,"%f",extent->maxy));
      ezxml_set_txt(ezxml_add_child(layerxml,"SRS",0),grid->srs);

      for(j=0; j<gridlink->grid->srs_aliases->nelts; j++) {
        bboxxml = ezxml_add_child(layerxml,"BoundingBox",0);
        ezxml_set_attr(bboxxml,"SRS", APR_ARRAY_IDX(gridlink->grid->srs_aliases,j,char*));
        ezxml_set_attr(bboxxml,"minx",apr_psprintf(ctx->pool,"%f",extent->minx));
        ezxml_set_attr(bboxxml,"miny",apr_psprintf(ctx->pool,"%f",extent->miny));
        ezxml_set_attr(bboxxml,"maxx",apr_psprintf(ctx->pool,"%f",extent->maxx));
        ezxml_set_attr(bboxxml,"maxy",apr_psprintf(ctx->pool,"%f",extent->maxy));
        ezxml_set_txt(ezxml_add_child(layerxml,"SRS",0),APR_ARRAY_IDX(gridlink->grid->srs_aliases,j,char*));
      }


      if(i==0) {
        char *resolutions;
        int i;
        /*wms-c only supports one grid per layer, so we use the first of the tileset's grids */
        ezxml_set_txt(ezxml_add_child(tsxml,"SRS",0),grid->srs);
        tmpxml = ezxml_add_child(tsxml,"BoundingBox",0);
        ezxml_set_attr(tmpxml,"SRS",grid->srs);
        ezxml_set_attr(tmpxml,"minx",apr_psprintf(ctx->pool,"%f",grid->extent.minx));
        ezxml_set_attr(tmpxml,"miny",apr_psprintf(ctx->pool,"%f",grid->extent.miny));
        ezxml_set_attr(tmpxml,"maxx",apr_psprintf(ctx->pool,"%f",grid->extent.maxx));
        ezxml_set_attr(tmpxml,"maxy",apr_psprintf(ctx->pool,"%f",grid->extent.maxy));

        resolutions="";

        for(i=gridlink->minz; i<gridlink->maxz; i++) {
          resolutions = apr_psprintf(ctx->pool,"%s%.20f ",resolutions,grid->levels[i]->resolution);
        }
        ezxml_set_txt(ezxml_add_child(tsxml,"Resolutions",0),resolutions);
        ezxml_set_txt(ezxml_add_child(tsxml,"Width",0),apr_psprintf(ctx->pool,"%d",grid->tile_sx));
        ezxml_set_txt(ezxml_add_child(tsxml,"Height",0),apr_psprintf(ctx->pool,"%d", grid->tile_sy));
      }
    }
    if(tileset->format && tileset->format->mime_type) {
      ezxml_set_txt(ezxml_add_child(tsxml,"Format",0),tileset->format->mime_type);
    } else {
      ezxml_set_txt(ezxml_add_child(tsxml,"Format",0),"image/unknown");
    }
    ezxml_set_txt(ezxml_add_child(tsxml,"Layers",0),tileset->name);
    ezxml_set_txt(ezxml_add_child(tsxml,"Styles",0),"");
    tileindex_index = apr_hash_next(tileindex_index);
  }


  tmpcaps = ezxml_toxml(caps);
  ezxml_free(caps);
  capheader=
    "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>\
<!DOCTYPE WMT_MS_Capabilities SYSTEM \"http://schemas.opengis.net/wms/1.1.0/capabilities_1_1_0.dtd\"\
[\
 <!ELEMENT VendorSpecificCapabilities EMPTY>\
]>\n";
  request->request.capabilities = apr_pstrcat(ctx->pool,capheader,tmpcaps,NULL);
  free(tmpcaps);
  request->request.mime_type = apr_pstrdup(ctx->pool,"text/xml");
}
示例#18
0
bool CMsnProto::MSN_StoreGetProfile(bool allowRecurse)
{
    char* reqHdr;
    ezxml_t tbdy;
    ezxml_t xmlp = storeSoapHdr("GetProfile", "Initial", tbdy, reqHdr);

    ezxml_t prohndl = ezxml_add_child(tbdy, "profileHandle", 0);

    ezxml_t alias = ezxml_add_child(prohndl, "Alias", 0);
    ezxml_t node = ezxml_add_child(alias, "Name", 0);
    ezxml_set_txt(node, mycid);
    node = ezxml_add_child(alias, "NameSpace", 0);
    ezxml_set_txt(node, "MyCidStuff");

    node = ezxml_add_child(prohndl, "RelationshipName", 0);
    ezxml_set_txt(node, "MyProfile");

    ezxml_t proattr = ezxml_add_child(tbdy, "profileAttributes", 0);
    node = ezxml_add_child(proattr, "ResourceID", 0);
    ezxml_set_txt(node, "true");
    node = ezxml_add_child(proattr, "DateModified", 0);
    ezxml_set_txt(node, "true");

    ezxml_t exproattr = ezxml_add_child(proattr, "ExpressionProfileAttributes", 0);
    node = ezxml_add_child(exproattr, "ResourceID", 0);
    ezxml_set_txt(node, "true");
    node = ezxml_add_child(exproattr, "DateModified", 0);
    ezxml_set_txt(node, "true");
    node = ezxml_add_child(exproattr, "DisplayName", 0);
    ezxml_set_txt(node, "true");
    node = ezxml_add_child(exproattr, "DisplayNameLastModified", 0);
    ezxml_set_txt(node, "true");
    node = ezxml_add_child(exproattr, "PersonalStatus", 0);
    ezxml_set_txt(node, "true");
    node = ezxml_add_child(exproattr, "PersonalStatusLastModified", 0);
    ezxml_set_txt(node, "true");
    node = ezxml_add_child(exproattr, "StaticUserTilePublicURL", 0);
    ezxml_set_txt(node, "true");
    node = ezxml_add_child(exproattr, "Photo", 0);
    ezxml_set_txt(node, "true");
    node = ezxml_add_child(exproattr, "Flags", 0);
    ezxml_set_txt(node, "true");

    char* szData = ezxml_toxml(xmlp, true);

    ezxml_free(xmlp);

    unsigned status = 0;
    char *storeUrl = NULL, *tResult = NULL;

    for (int k = 4; --k;)
    {
        mir_free(storeUrl);
        storeUrl = GetStoreHost("GetProfile");
        tResult = getSslResult(&storeUrl, szData, reqHdr, status);
        if (tResult == NULL) UpdateStoreHost("GetProfile", NULL);
        else break;
    }

    mir_free(reqHdr);
    free(szData);

    if (tResult != NULL)
    {
        if (status == 200)
        {
            ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult));
            ezxml_t body = getSoapResponse(xmlm, "GetProfile");

            UpdateStoreHost("GetProfile", body ? storeUrl : NULL);

            mir_snprintf(proresid, sizeof(proresid), "%s", ezxml_txt(ezxml_child(body, "ResourceID")));

            ezxml_t expr = ezxml_child(body, "ExpressionProfile");
            if (expr == NULL)
            {
                MSN_StoreShareItem(proresid);
                MSN_SharingMyProfile();
                if (allowRecurse) MSN_StoreGetProfile(false);
            }
            else
            {
                const char* szNick = ezxml_txt(ezxml_child(expr, "DisplayName"));
                setStringUtf(NULL, "Nick", (char*)szNick);

                const char* szStatus = ezxml_txt(ezxml_child(expr, "PersonalStatus"));
                replaceStr(msnLastStatusMsg, szStatus);

                mir_snprintf(expresid, sizeof(expresid), "%s", ezxml_txt(ezxml_child(expr, "ResourceID")));

                ezxml_t photo = ezxml_child(expr, "Photo");
                mir_snprintf(photoid, sizeof(photoid), "%s", ezxml_txt(ezxml_child(photo, "ResourceID")));

                ezxml_t docstr = ezxml_get(photo, "DocumentStreams", 0, "DocumentStream", -1);
                while (docstr)
                {
                    const char *docname = ezxml_txt(ezxml_child(docstr, "DocumentStreamName"));
                    if (!strcmp(docname, "UserTileStatic"))
                    {
                        getMyAvatarFile(ezxml_txt(ezxml_child(docstr, "PreAuthURL")), _T("miranda_avatar.tmp"));
                        break;
                    }
                    docstr = ezxml_next(docstr);
                }
            }
            ezxml_free(xmlm);
        }
        else if (status == 500 && allowRecurse)
        {
            ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult));
            const char* szErr = ezxml_txt(getSoapFault(xmlm, true));
            if (strcmp(szErr, "PassportAuthFail") == 0)
            {
                MSN_GetPassportAuth();
                MSN_StoreGetProfile(false);
            }
            else
            {
                MSN_StoreCreateProfile();
                if (MSN_StoreGetProfile(false)) status = 200;
            }
            ezxml_free(xmlm);
        }
        else
            UpdateStoreHost("GetProfile", NULL);

    }
    mir_free(tResult);
    mir_free(storeUrl);

    return status == 200;
}
示例#19
0
void CMsnProto::getOIMs(ezxml_t xmli)
{
	ezxml_t toki = ezxml_child(xmli, "M");
	if (toki == NULL) return;

	char* getReqHdr;
	ezxml_t reqmsg;
	ezxml_t xmlreq = oimRecvHdr("GetMessage", reqmsg, getReqHdr);

	ezxml_t reqmid = ezxml_add_child(reqmsg, "messageId", 0);
	ezxml_t reqmrk = ezxml_add_child(reqmsg, "alsoMarkAsRead", 0);
	ezxml_set_txt(reqmrk, "false");

	char* delReqHdr;
	ezxml_t delmsg;
	ezxml_t xmldel = oimRecvHdr("DeleteMessages", delmsg, delReqHdr);
	ezxml_t delmids = ezxml_add_child(delmsg, "messageIds", 0);

	while (toki != NULL) {
		const char* szId = ezxml_txt(ezxml_child(toki, "I"));
		const char* szEmail = ezxml_txt(ezxml_child(toki, "E"));

		ezxml_set_txt(reqmid, szId);
		char* szData = ezxml_toxml(xmlreq, true);

		unsigned status;
		char* url = (char*)mir_strdup(oimRecvUrl);

		char* tResult = getSslResult(&url, szData, getReqHdr, status);

		free(szData);
		mir_free(url);

		if (tResult != NULL && status == 200) {
			ezxml_t xmlm = ezxml_parse_str(tResult, mir_strlen(tResult));
			ezxml_t body = getSoapResponse(xmlm, "GetMessage");

			MimeHeaders mailInfo;
			const char* mailbody = mailInfo.readFromBuffer((char*)ezxml_txt(body));

			time_t evtm = time(NULL);
			const char* arrTime = mailInfo["X-OriginalArrivalTime"];
			if (arrTime != NULL) {
				char szTime[32], *p;
				txtParseParam(arrTime, "FILETIME", "[", "]", szTime, sizeof(szTime));

				unsigned filetimeLo = strtoul(szTime, &p, 16);
				if (*p == ':') {
					unsigned __int64 filetime = strtoul(p + 1, &p, 16);
					filetime <<= 32;
					filetime |= filetimeLo;
					filetime /= 10000000;
#ifndef __GNUC__
					filetime -= 11644473600ui64;
#else
					filetime -= 11644473600ull;
#endif
					evtm = (time_t)filetime;
				}
			}

			PROTORECVEVENT pre = { 0 };
			pre.szMessage = mailInfo.decodeMailBody((char*)mailbody);
			pre.timestamp = evtm;
			ProtoChainRecvMsg(MSN_HContactFromEmail(szEmail), &pre);
			mir_free(pre.szMessage);

			ezxml_t delmid = ezxml_add_child(delmids, "messageId", 0);
			ezxml_set_txt(delmid, szId);

			ezxml_free(xmlm);
		}
		mir_free(tResult);
		toki = ezxml_next(toki);
	}
	ezxml_free(xmlreq);
	mir_free(getReqHdr);

	if (ezxml_child(delmids, "messageId") != NULL) {
		char* szData = ezxml_toxml(xmldel, true);

		unsigned status;
		char* url = (char*)mir_strdup(oimRecvUrl);

		char* tResult = getSslResult(&url, szData, delReqHdr, status);

		mir_free(url);
		mir_free(tResult);
		free(szData);
	}
	ezxml_free(xmldel);
	mir_free(delReqHdr);
}
示例#20
0
void _create_capabilities_wmts(mapcache_context *ctx, mapcache_request_get_capabilities *req, char *url, char *path_info, mapcache_cfg *cfg)
{
  const char *onlineresource;
  mapcache_request_get_capabilities_wmts *request = (mapcache_request_get_capabilities_wmts*)req;
  ezxml_t caps;
  ezxml_t contents;
  ezxml_t operations_metadata;
  apr_hash_index_t *layer_index;
  apr_hash_index_t *grid_index;
  char *tmpcaps;
  apr_table_t *requiredGrids = apr_table_make(ctx->pool, apr_hash_count(cfg->grids));
#ifdef DEBUG
  if(request->request.request.type != MAPCACHE_REQUEST_GET_CAPABILITIES) {
    ctx->set_error(ctx,500,"wrong wmts capabilities request");
    return;
  }
#endif

  onlineresource = apr_table_get(cfg->metadata,"url");
  if(!onlineresource) {
    onlineresource = url;
  }

  request->request.mime_type = apr_pstrdup(ctx->pool,"application/xml");

  caps = _wmts_capabilities(ctx,cfg);
  ezxml_insert(_wmts_service_identification(ctx,cfg),caps,0);
  ezxml_insert(_wmts_service_provider(ctx,cfg),caps,0);

  operations_metadata = ezxml_add_child(caps,"ows:OperationsMetadata",0);
  ezxml_insert(_wmts_operations_metadata(ctx,onlineresource,"GetCapabilities"),operations_metadata,0);
  ezxml_insert(_wmts_operations_metadata(ctx,onlineresource,"GetTile"),operations_metadata,0);
  ezxml_insert(_wmts_operations_metadata(ctx,onlineresource,"GetFeatureInfo"),operations_metadata,0);

  /* @todo: support both, url and embed profile */
  if( apr_table_get(cfg->metadata,"inspire_profile") )
    ezxml_insert(_wmts_inspire_metadata(ctx,cfg),operations_metadata,0);

  contents = ezxml_add_child(caps,"Contents",0);

  layer_index = apr_hash_first(ctx->pool,cfg->tilesets);
  while(layer_index) {
    int i;
    mapcache_tileset *tileset;
    const void *key;
    apr_ssize_t keylen;
    ezxml_t layer;
    const char *title;
    const char *abstract;
    ezxml_t style;
    char *dimensionstemplate="";
    ezxml_t resourceurl;

    apr_hash_this(layer_index,&key,&keylen,(void**)&tileset);

    layer = ezxml_add_child(contents,"Layer",0);
    title = apr_table_get(tileset->metadata,"title");
    if(title) {
      ezxml_set_txt(ezxml_add_child(layer,"ows:Title",0),title);
    } else {
      ezxml_set_txt(ezxml_add_child(layer,"ows:Title",0),tileset->name);
    }
    abstract = apr_table_get(tileset->metadata,"abstract");
    if(abstract) {
      ezxml_set_txt(ezxml_add_child(layer,"ows:Abstract",0),abstract);
    }

    ezxml_set_txt(ezxml_add_child(layer,"ows:Identifier",0),tileset->name);

    style = ezxml_add_child(layer,"Style",0);
    ezxml_set_attr(style,"isDefault","true");
    ezxml_set_txt(ezxml_add_child(style,"ows:Identifier",0),"default");

    if(tileset->format && tileset->format->mime_type)
      ezxml_set_txt(ezxml_add_child(layer,"Format",0),tileset->format->mime_type);
    else
      ezxml_set_txt(ezxml_add_child(layer,"Format",0),"image/unknown");



    if(tileset->dimensions) {
      for(i=0; i<tileset->dimensions->nelts; i++) {
        const char **values;
        const char **value;
        mapcache_dimension *dimension = APR_ARRAY_IDX(tileset->dimensions,i,mapcache_dimension*);
        ezxml_t dim = ezxml_add_child(layer,"Dimension",0);
        ezxml_set_txt(ezxml_add_child(dim,"ows:Identifier",0),dimension->name);
        ezxml_set_txt(ezxml_add_child(dim,"Default",0),dimension->default_value);

        if(dimension->unit) {
          ezxml_set_txt(ezxml_add_child(dim,"UOM",0),dimension->unit);
        }
        values = dimension->print_ogc_formatted_values(ctx,dimension);
        value = values;
        while(*value) {
          ezxml_set_txt(ezxml_add_child(dim,"Value",0),*value);
          value++;
        }
        dimensionstemplate = apr_pstrcat(ctx->pool,dimensionstemplate,"{",dimension->name,"}/",NULL);
      }
    }
    if(tileset->source && tileset->source->info_formats) {
      int i;
      for(i=0; i<tileset->source->info_formats->nelts; i++) {
        char *iformat = APR_ARRAY_IDX(tileset->source->info_formats,i,char*);
        ezxml_set_txt(ezxml_add_child(layer,"InfoFormat",0),iformat);
      }
    }

    if(tileset->wgs84bbox.minx != tileset->wgs84bbox.maxx) {
      ezxml_t bbox = ezxml_add_child(layer,"ows:WGS84BoundingBox",0);
      ezxml_set_txt(ezxml_add_child(bbox,"ows:LowerCorner",0),
                    apr_psprintf(ctx->pool,"%f %f",tileset->wgs84bbox.minx, tileset->wgs84bbox.miny));
      ezxml_set_txt(ezxml_add_child(bbox,"ows:UpperCorner",0),
                    apr_psprintf(ctx->pool,"%f %f",tileset->wgs84bbox.maxx, tileset->wgs84bbox.maxy));
    }

    for(i=0; i<tileset->grid_links->nelts; i++) {
      mapcache_grid_link *grid_link = APR_ARRAY_IDX(tileset->grid_links,i,mapcache_grid_link*);
      ezxml_t tmsetlnk = ezxml_add_child(layer,"TileMatrixSetLink",0);
      ezxml_set_txt(ezxml_add_child(tmsetlnk,"TileMatrixSet",0),grid_link->grid->name);

      /*
       * remember TileMatrixSetLinks
       */
      apr_table_setn(requiredGrids, grid_link->grid->name, "true");

      if(grid_link->restricted_extent) {
        ezxml_t limits = ezxml_add_child(tmsetlnk,"TileMatrixSetLimits",0);
        int j;
        for(j=0; j<grid_link->grid->nlevels; j++) {
          ezxml_t matrixlimits = ezxml_add_child(limits,"TileMatrixLimits",0);
          ezxml_set_txt(ezxml_add_child(matrixlimits,"TileMatrix",0),
                        apr_psprintf(ctx->pool,"%s:%d",grid_link->grid->name,j));
          ezxml_set_txt(ezxml_add_child(matrixlimits,"MinTileRow",0),
                        apr_psprintf(ctx->pool,"%d",grid_link->grid_limits[j].minx));
          ezxml_set_txt(ezxml_add_child(matrixlimits,"MaxTileRow",0),
                        apr_psprintf(ctx->pool,"%d",grid_link->grid_limits[j].maxx-1));
          ezxml_set_txt(ezxml_add_child(matrixlimits,"MinTileCol",0),
                        apr_psprintf(ctx->pool,"%d",grid_link->grid_limits[j].miny));
          ezxml_set_txt(ezxml_add_child(matrixlimits,"MaxTileCol",0),
                        apr_psprintf(ctx->pool,"%d",grid_link->grid_limits[j].maxy-1));
        }
      }

      /*
       * gaia gis chokes if this is added to the capabilities doc,
       * so disable it for now
       *
      double *gbbox = grid_link->restricted_extent?grid_link->restricted_extent:grid_link->grid->extent;
      ezxml_t bbox = ezxml_add_child(layer,"ows:BoundingBox",0);
      ezxml_set_txt(ezxml_add_child(bbox,"ows:LowerCorner",0),
            apr_psprintf(ctx->pool,"%f %f",gbbox[0], gbbox[1]));
      ezxml_set_txt(ezxml_add_child(bbox,"ows:UpperCorner",0),
            apr_psprintf(ctx->pool,"%f %f",gbbox[2], gbbox[3]));
      ezxml_set_attr(bbox,"crs",mapcache_grid_get_crs(ctx,grid_link->grid));
      */
    }

    if(tileset->source && tileset->source->info_formats) {
      int i;
      for(i=0; i<tileset->source->info_formats->nelts; i++) {
        char *iformat = APR_ARRAY_IDX(tileset->source->info_formats,i,char*);
        ezxml_t resourceurl;
        resourceurl = ezxml_add_child(layer,"ResourceURL",0);
        ezxml_set_attr(resourceurl,"format",iformat);
        ezxml_set_attr(resourceurl,"resourceType","FeatureInfo");
        ezxml_set_attr(resourceurl,"template",
                       apr_pstrcat(ctx->pool,onlineresource,"wmts/1.0.0/",tileset->name,"/default/",
                                   dimensionstemplate,"{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.",apr_psprintf(ctx->pool,"%d",i),NULL));
      }
    }
示例#21
0
文件: xmlns_si.c 项目: biddyweb/xwbot
/**
 * \return <si/> response to <si/> request
 */
static int
xmlns_si_file_accept(struct x_bus *sess, ezxml_t __stnz)
{
  char *str;

  int err;
  ezxml_t stream_job;

  ezxml_t _stnz1;
  ezxml_t _stnz2;
  char *fname, *siz;

  ENTER;

  _stnz1 = ezxml_child(__stnz, "file");

  if (!_stnz1)
    goto ftexception;

  fname = (char *) ezxml_attr(_stnz1, "name");
  siz = (char *) ezxml_attr(_stnz1, "size");

  // get features
  for (_stnz2 = ezxml_get(__stnz, "feature", -1); _stnz2; _stnz2
      = ezxml_next(_stnz2))
    {
      str = (char *) ezxml_attr(_stnz2, "xmlns");
      if (str && strstr(str, "feature-neg"))
        break;
    };

  if (!_stnz2)
    goto ftexception;

  // find stream-method
  for (_stnz2 = ezxml_get(_stnz2, "x", 0, "field", -1); _stnz2; _stnz2
      = ezxml_next(_stnz2))
    {
      str = (char *) ezxml_attr(_stnz2, "var");
      if (str && strstr(str, "stream-method"))
        break;
    };

  if (!_stnz2)
    goto ftexception;

  // get all stream methods
  for (_stnz2 = ezxml_child(_stnz2, "option"); _stnz2; _stnz2
      = ezxml_next(_stnz2))
    {
      _stnz1 = ezxml_child(_stnz2, "value");
      if (_stnz1)
        printf("STREAM: %s\n", _stnz1->txt);
      if (!strcmp(_stnz1->txt, XMLNS_BYTESTREAMS))
        break;
    };

  if (!_stnz2)
    goto ftexception;

  /* enter critical section */
  pthread_mutex_lock(&sess->lock);
  // create new file transfer job
  _stnz2 = ezxml_get(sess->dbcore, "bytestreams", 0, "pending", -1);
  if (!_stnz2)
    {
      _stnz2 = ezxml_child(sess->dbcore, "bytestreams");
      _stnz2 = ezxml_add_child(_stnz2, "pending", 0);
    }
  err = !_stnz2->child;
  /* if some pending job already exists */
  if (err)
    {
      stream_job = ezxml_new("job");
      ezxml_set_attr(stream_job, "type", "file-transfer");
      ezxml_set_attr_d(stream_job, "id", ezxml_attr(__stnz,"id"));
      if (ezxml_attr(__stnz, "mime-type"))
        ezxml_set_attr_d(stream_job, "mime-type", ezxml_attr(__stnz,"mime-type"));
      ezxml_set_attr_d(stream_job, "profile", ezxml_attr(__stnz,"profile"));
      ezxml_set_attr_d(stream_job, "name", fname);
      ezxml_set_attr(stream_job, "source", "remote");
      ezxml_set_attr(stream_job, "src_fd", "0");
      ezxml_set_attr(stream_job, "dst_fd", "0");
      ezxml_set_attr(stream_job, "status", "0");

      _stnz2 = ezxml_get(sess->dbcore, "bytestreams", 0, "pending", -1);
      ezxml_insert(stream_job, _stnz2, 0);

      /* leave critical section */
      pthread_mutex_unlock(&sess->lock);
    }
  else
    {
      /* leave critical section */
      pthread_mutex_unlock(&sess->lock);
      goto ftexception;
    }

  // create si response
  _stnz1 = ezxml_new("si");
  ezxml_set_attr(_stnz1, "xmlns", XMLNS_SI);

  _stnz2 = ezxml_add_child(_stnz1, "feature", 0);
  ezxml_set_attr(_stnz2, "xmlns", XMLNS_FEATURE_NEG);

  _stnz2 = ezxml_add_child(_stnz2, "x", 0);
  ezxml_set_attr(_stnz2, "xmlns", XMLNS_X_DATA);
  ezxml_set_attr(_stnz2, "type", "submit");

  _stnz2 = ezxml_add_child(_stnz2, "field", 0);
  ezxml_set_attr(_stnz2, "var", "stream-method");

  _stnz2 = ezxml_add_child(_stnz2, "value", 0);
  ezxml_set_txt(_stnz2, XMLNS_BYTESTREAMS);

  EXIT;

  xmpp_session_reply_iq_stanza(sess,__stnz,_stnz1);

  return 0;

  ftexception:
  // create si response
  _stnz1 = ezxml_new("error");
  ezxml_set_attr(_stnz1, "code", "400");
  ezxml_set_attr_d(_stnz1,"type","cancel");

  _stnz2 = ezxml_add_child(_stnz1, "bad-request", 0);
  ezxml_set_attr(_stnz2, "xmlns", XMLNS_XMPP_STANZAS);
  _stnz2 = ezxml_add_child(_stnz1, "no-valid-streams", 0);
  ezxml_set_attr(_stnz2, "xmlns", XMLNS_SI);

  EXIT;

  xmpp_session_reply_iq_stanza(sess,__stnz,_stnz1);

  return -1;

}
示例#22
0
文件: xmlns_si.c 项目: biddyweb/xwbot
static int
xmpp_send_file(struct x_bus *sess, const char *jid, const char *name)
{
  struct stat f_stat;
  char ts[25];
  pthread_t t;
  ezxml_t stream_job;
  ezxml_t __stnz;
  ezxml_t _s1;
  ezxml_t _s2;
  char *myjid = NULL;

  if (stat(name, &f_stat))
    return -1;

  pthread_mutex_lock(&sess->lock);
  myjid = x_strdup(ezxml_attr(sess->dbcore, "jid"));
  pthread_mutex_unlock(&sess->lock);

  __stnz = ezxml_new("iq");
  ezxml_set_attr(__stnz, "type", "set");
  ezxml_set_attr_d(__stnz,"to",jid);
  ezxml_set_attr(__stnz, "from", myjid);
  // TODO Randomize ID
  ezxml_set_attr(__stnz, "id", "some-id");

  _s1 = ezxml_add_child(__stnz, "si", 0);
  ezxml_set_attr(_s1, "xmlns", XMLNS_SI);
  sprintf(ts, "s5b_%x", (int) (random() + time(NULL)));
  ezxml_set_attr_d(_s1,"id",ts);
  ezxml_set_attr(_s1, "profile", XMLNS_FILE_TRANSFER);

  _s2 = ezxml_add_child(_s1, "file", 0);
  ezxml_set_attr(_s2, "xmlns", XMLNS_FILE_TRANSFER);
  ezxml_set_attr_d(_s2,"name",name);
  sprintf(ts, "%d", (int) f_stat.st_size);
  ezxml_set_attr_d(_s2,"size",ts);

  _s2 = ezxml_add_child(_s1, "feature", 0);
  ezxml_set_attr(_s2, "xmlns", XMLNS_FEATURE_NEG);

  _s2 = ezxml_add_child(_s2, "x", 0);
  ezxml_set_attr(_s2, "xmlns", XMLNS_X_DATA);
  ezxml_set_attr(_s2, "type", "form");

  _s2 = ezxml_add_child(_s2, "field", 0);
  ezxml_set_attr(_s2, "var", "stream-method");
  ezxml_set_attr(_s2, "type", "list-single");

  _s2 = ezxml_add_child(_s2, "option", 0);
  _s2 = ezxml_add_child(_s2, "value", 0);
  ezxml_set_txt(_s2, XMLNS_BYTESTREAMS);

  /* enter critical section */
  pthread_mutex_lock(&sess->lock);
  // create new file transfer job
  // this job should be created and added to
  // new main event loop
  _s2 = ezxml_get(sess->dbcore, "bytestreams", 0, "pending", -1);
  if (!_s2)
    {
      _s2 = ezxml_get(sess->dbcore, "bytestreams", -1);
      _s2 = ezxml_add_child(_s2, "pending", 0);
    }
  _s2 = ezxml_child(_s2, "job");
  /* if some pending job already exists */
  if (!_s2)
    {
      // create new stream job
      stream_job = ezxml_new("job");
      ezxml_set_attr_d(stream_job, "jid", jid);
      ezxml_set_attr_d(stream_job, "id",ezxml_attr(_s1,"id"));
      ezxml_set_attr(stream_job, "type", "file-transfer");
      ezxml_set_attr(stream_job, "source", "local");
      ezxml_set_attr_d(stream_job, "name", name);
      ezxml_set_attr(stream_job, "src_fd", "0");
      ezxml_set_attr(stream_job, "dst_fd", "0");
      ezxml_set_attr(stream_job, "status", "0");

      _s2 = ezxml_get(sess->dbcore, "bytestreams", 0, "pending", -1);
      ezxml_insert(stream_job, _s2, 0);
      xmpp_stanza2stdout(sess->dbcore);
    }
  pthread_mutex_unlock(&sess->lock);

  // FIXME
  pthread_create(&t, NULL, sock5srv, (void *) sess);
  sprintf(ts, "%d", (int) t);
  pthread_mutex_lock(&sess->lock);
  _s2 = ezxml_get(sess->dbcore, "threads", -1);
  if (_s2)
    {
      _s2 = ezxml_add_child(_s2, "thread", 0);
      ezxml_set_attr(_s2, "name", "socks5");
      ezxml_set_attr_d(_s2,"id",ts);
    }
  pthread_mutex_unlock(&sess->lock);

  EXIT;

  xmpp_session_send_stanza(sess, __stnz);
  ezxml_free(__stnz);
  if (myjid)
    free(myjid);

  return 0;
}
ClParserPtrT clParserSetTxt(ClParserPtrT xml, const char *txt)
{
    return ezxml_set_txt(xml, txt);
}
示例#24
0
bool CMsnProto::MSN_StoreUpdateProfile(const char* szNick, const char* szStatus, bool lock, bool allowRecurse)
{
    char* reqHdr;
    ezxml_t tbdy;
    ezxml_t xmlp = storeSoapHdr("UpdateProfile", "RoamingIdentityChanged", tbdy, reqHdr);

    ezxml_t pro = ezxml_add_child(tbdy, "profile", 0);
    ezxml_t node = ezxml_add_child(pro, "ResourceID", 0);
    ezxml_set_txt(node, proresid);

    ezxml_t expro = ezxml_add_child(pro, "ExpressionProfile", 0);
    node = ezxml_add_child(expro, "FreeText", 0);
    ezxml_set_txt(node, "Update");
    if (szNick)
    {
        node = ezxml_add_child(expro, "DisplayName", 0);
        ezxml_set_txt(node, szNick);
    }
    if (szStatus)
    {
        node = ezxml_add_child(expro, "PersonalStatus", 0);
        ezxml_set_txt(node, szStatus);
    }
    node = ezxml_add_child(expro, "Flags", 0);
    ezxml_set_txt(node, lock ? "1" : "0");

    char* szData = ezxml_toxml(xmlp, true);

    ezxml_free(xmlp);

    unsigned status = 0;
    char *storeUrl = NULL, *tResult = NULL;

    for (int k = 4; --k;)
    {
        mir_free(storeUrl);
        storeUrl = GetStoreHost("UpdateProfile");
        tResult = getSslResult(&storeUrl, szData, reqHdr, status);
        if (tResult == NULL) UpdateStoreHost("UpdateProfile", NULL);
        else break;
    }

    mir_free(reqHdr);
    free(szData);

    if (tResult != NULL)
    {
        UpdateStoreHost("UpdateProfile", storeUrl);
        if (status == 200)
        {
            replaceStr(msnLastStatusMsg, szStatus);
            MSN_ABUpdateDynamicItem();
        }
        else if (status == 500 && allowRecurse)
        {
            ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult));
            const char* szErr = ezxml_txt(getSoapFault(xmlm, true));
            if (strcmp(szErr, "PassportAuthFail") == 0)
            {
                MSN_GetPassportAuth();
                status = MSN_StoreUpdateProfile(szNick, szStatus, lock, false) ? 200 : 500;
            }
            ezxml_free(xmlm);
        }
    }

    mir_free(tResult);
    mir_free(storeUrl);

    return status == 200;
}
示例#25
0
int _wmts_inspire_metadata_responselanguages(void *in, const char *key, const char *value) {
   ezxml_t node = (ezxml_t )in;
   ezxml_set_txt(ezxml_add_child(node,"inspire_common:Language",0),value);

   return 1;
}
示例#26
0
int _wmts_service_identification_keywords(void *in, const char *key, const char *value) {
   ezxml_t node = (ezxml_t )in;
   ezxml_set_txt(ezxml_add_child(node,"ows:Keyword",0),value);

   return 1;
}