Beispiel #1
0
bool CrpcBase::rpcInt(CXmlNodePtr param, const char *name, int& value)
{
	cvs::string fnd;
	CXmlNodePtr val;

	val = param->Clone();
	if(!strcmp(val->GetName(),"param")) 
		val->GetChild();
	if(!strcmp(val->GetName(),"struct"))
	{
		if(name)
		{
			cvs::sprintf(fnd,64,"member[@name='%s']",name);
			if(!val->Lookup(fnd.c_str()))
				return false;
			if(!val->XPathResultNext())
				return false;
		}
		else
			val->GetChild();
		val->GetChild("value");
	}
	if(strcmp(val->GetName(),"value"))
		return false;
	if(!val->GetChild())
		return false;
	if(strcmp(val->GetName(),"i4"))
		return false;
	value = atoi(val->GetValue());
	return true;
}
Beispiel #2
0
bool CrpcBase::rpcObj(CXmlNodePtr param, const char *name, rpcObject *rpcObj)
{
	cvs::string fnd;
	CXmlNodePtr val;

	val = param->Clone();
	if(!strcmp(val->GetName(),"param")) 
		val->GetChild();
	if(!strcmp(val->GetName(),"struct"))
	{
		if(name)
		{
			cvs::sprintf(fnd,64,"member[@name='%s']",name);
			if(!val->Lookup(fnd.c_str()))
				return false;
			if(!val->XPathResultNext())
				return false;
		}
		else
			val->GetChild();
		val->GetChild("value");
	}
	if(strcmp(val->GetName(),"value"))
		return false;
	if(!val->GetChild())
		return false;
	if(strcmp(val->GetName(),"struct"))
		return false;
	return rpcObj->Marshall(val);
}
Beispiel #3
0
bool CrpcBase::rpcArray(CXmlNodePtr param, const char *name, CXmlNodePtr& node)
{
	CXmlNodePtr val = param->Clone();

	if(!strcmp(val->GetName(),"param"))
		val->GetChild();
	if(!strcmp(val->GetName(),"array"))
		return false;

	if(!node)
	{
		if(!val->GetChild())
			return false;
		if(!strcmp(val->GetName(),"data"))
			return false;
		node = val->Clone();
		return true;
	}
	else
	{
		if(!node->GetParent()) return false;
		if(!node->GetSibling()) return false;
		if(!strcmp(node->GetName(),"data"))
			return false;
		if(!node->GetChild()) return false;
		return true;
	}
}
Beispiel #4
0
static Dtype chacl_dirproc (void *callerdat, char *dir, char *repos, char *update_dir,  List *entries, const char *virtual_repository, Dtype hint)
{
	CXmlNodePtr curdir;

	if(hint!=R_PROCESS)
		return hint;

	if(!quiet)
		printf("%sing ACL for directory %s\n",parms.del?"delet":"sett",update_dir);

	curdir = fileattr_getroot();
	if(!curdir->GetChild("directory")) curdir->NewNode("directory");
	set_acl(curdir);

	xfree(acl_directory_set);
	acl_directory_set = xstrdup(repos);

	return R_PROCESS;
}
Beispiel #5
0
void CInfoPanel::LoaderThread()
{
	m_news.clear();
	CHttpSocket sock;
	cvs::string xml;
	CXmlTree tree;
	size_t len;

	if(!sock.create("http://march-hare.com"))
	{
		xml="<?xml version=\"1.0\" encoding=\"windows-1252\"?>\n<messages>\n<message><subject>Need assistance?  Click here for our professional support options!</subject><author>&quot;March Hare Support&quot; &lt;[email protected]&gt;</author><url>http://store.march-hare.com/s.nl?sc=2&amp;category=2</url></message>\n</messages>";
		len=xml.length();
	}
	else if(!sock.request("GET","/cvspro/prods-pre.asp?register=advert"))
	{
		xml="<?xml version=\"1.0\" encoding=\"windows-1252\"?>\n<messages>\n<message><subject>Need help NOW?  Click here for our professional support options!</subject><author>&quot;March Hare Support&quot; &lt;[email protected]&gt;</author><url>http://store.march-hare.com/s.nl?sc=2&amp;category=2</url></message>\n</messages>";
		len=xml.length();
	}
	if(sock.responseCode()!=200)
	{
		xml="<?xml version=\"1.0\" encoding=\"windows-1252\"?>\n<messages>\n<message><subject>Need help? Need integration?  Need training?  Click here for our professional support options!</subject><author>&quot;March Hare Support&quot; &lt;[email protected]&gt;</author><url>http://store.march-hare.com/s.nl?sc=2&amp;category=2</url></message>\n</messages>";
		len=xml.length();
	}
	else
	{
		cvs::string xml = sock.responseData(len);
	}
	if(!tree.ParseXmlFromMemory(xml.c_str()))
		return;
	CXmlNodePtr node = tree.GetRoot();
	if(strcmp(node->GetName(),"messages"))
		return;
	if(!node->GetChild("message"))
		return;

	do
	{
		news_t n;
		n.subject = node->GetNodeValue("subject");
		n.author = node->GetNodeValue("author");
		n.url = node->GetNodeValue("url");
		m_news.push_back(n);
	} while(node->GetSibling("message"));

	if(!m_hItemFont)
	{
		HFONT hFont = (HFONT)SendMessage(m_hListWnd,WM_GETFONT,0,0);
		if(!hFont) hFont=GetStockFont(DEFAULT_GUI_FONT);

		LOGFONT lf = {0};
		GetObject(hFont,sizeof(lf),&lf);
		lf.lfUnderline=true;
		m_hItemFont = CreateFontIndirect(&lf);
	}

	ListView_DeleteAllItems(m_hListWnd);
	ListView_DeleteColumn(m_hListWnd,1);
	LVCOLUMN lvc={0};
	lvc.mask=LVCF_WIDTH|LVCF_TEXT;
	lvc.cx=500;
	lvc.pszText=_T("Title");
	ListView_InsertColumn(m_hListWnd,0,&lvc);
	lvc.mask=LVCF_WIDTH|LVCF_TEXT;
	lvc.cx=300;
	lvc.pszText=_T("Author");
	ListView_InsertColumn(m_hListWnd,1,&lvc);

	for(size_t n=0; n<m_news.size(); n++)
	{
		LVITEM lvi = {0};
		cvs::wide wnews(m_news[n].subject.c_str());
		cvs::wide wauth(m_news[n].author.c_str());
		lvi.mask=LVIF_TEXT|LVIF_PARAM;
		lvi.iItem=(int)n;
		lvi.pszText=(LPWSTR)(const wchar_t*)wnews;
		lvi.lParam=(LPARAM)&m_news[n];
		int iItem = ListView_InsertItem(m_hListWnd,&lvi);
		ListView_SetItemText(m_hListWnd,iItem,1,(LPWSTR)(const wchar_t*)wauth);
	}
	m_bLoaded = true;
}