All pastes #66155 Raw Edit

Miscellany

public text v1 · immutable
#66155 ·published 2006-06-16 12:56 UTC
rendered paste body
   //now get the config file for this plugin
    if (!osync_member_get_config(mMember, &configData, &configSize, error))
    {
      osync_error_update(error, "Unable to get config data: %s", osync_error_print(error));
      isKcal=true; isKaddrbook=true; isKnotes=true;
    }

//parse xml 
    xmlDocPtr doc;
    xmlNodePtr cur;
    doc = xmlParseMemory(configData, configSize);
    if(doc)
    {
      if( (cur=xmlDocGetRootElement(doc)) &&
          (xmlStrcmp(cur->name, (xmlChar*)"config")) )
      {
        cur = cur->xmlChildrenNode;
        while (cur != NULL)
        {
          xmlChar *str = xmlNodeGetContent(cur);
          if (str)
          {
            if (!xmlStrcmp(cur->name, (const xmlChar *)"contacts"))
            {
              isKaddrbook = ( !xmlStrcmp(str, (const xmlChar *)"true") ?
			    (true): (false) );
            }
            if (!xmlStrcmp(cur->name, (const xmlChar *)"calendar"))
            {
              isKcal = ( !xmlStrcmp(str, (const xmlChar *)"true") ?
			    (true): (false) );
            }
            if (!xmlStrcmp(cur->name, (const xmlChar *)"notes"))
            {
              isKnotes = ( !xmlStrcmp(str, (const xmlChar *)"true") ?
			    (true): (false) );
            }
            xmlFree(str);
          }
          cur = cur->next;
        }
      }
      xmlFreeDoc(doc);
    }