- client: don't do two RSS fetches at once

- manager: WxWidget's HTML renderer doesn't seem to like \n's.
		For example, if you try to render
			foo
			<img src=...>
			blah
		all it shows is foo.
		Work around this by replacing \n's with <br>

svn path=/trunk/boinc/; revision=22017
This commit is contained in:
David Anderson 2010-07-20 23:13:26 +00:00
parent bb35d196ef
commit a33d6a6f8b
3 changed files with 53 additions and 19 deletions

View File

@ -5313,3 +5313,18 @@ David 20 Jul 2010
configure.ac configure.ac
Makefile.am Makefile.am
David 20 Jul 2010
- client: don't do two RSS fetches at once
- manager: WxWidget's HTML renderer doesn't seem to like \n's.
For example, if you try to render
foo
<img src=...>
blah
all it shows is foo.
Work around this by replacing \n's with <br>
client/
cs_notice.cpp
clientgui/
NoticeListCtrl.cpp

View File

@ -602,6 +602,7 @@ bool RSS_FEED_OP::poll() {
strcpy(url, rf.url); strcpy(url, rf.url);
} }
gstate.gui_http.do_rpc(this, url, filename); gstate.gui_http.do_rpc(this, url, filename);
break;
} }
} }
return false; return false;

View File

@ -172,6 +172,22 @@ wxAccStatus CNoticeListCtrlAccessible::DoDefaultAction(int childId)
return wxACC_NOT_IMPLEMENTED; return wxACC_NOT_IMPLEMENTED;
} }
static void fix_html(const char* in, char* out) {
while (*in) {
switch (*in) {
case '\n':
strcpy(out, "<br>");
out += 4;
break;
case '\r':
break;
default:
*out++ = *in;
}
in++;
}
*out = 0;
}
// Returns the description for this object or a child. // Returns the description for this object or a child.
wxAccStatus CNoticeListCtrlAccessible::GetDescription(int childId, wxString* description) wxAccStatus CNoticeListCtrlAccessible::GetDescription(int childId, wxString* description)
@ -183,26 +199,26 @@ wxAccStatus CNoticeListCtrlAccessible::GetDescription(int childId, wxString* des
wxString strProjectName = wxEmptyString; wxString strProjectName = wxEmptyString;
wxString strArrivalTime = wxEmptyString; wxString strArrivalTime = wxEmptyString;
if (pDoc && (childId != wxACC_SELF)) if (pDoc && (childId != wxACC_SELF)) {
{
strBuffer = wxEmptyString; strBuffer = wxEmptyString;
if (pDoc)
{ // WxWidget's HTML renderer gets messed up by \n's. change to <br>
strDescription = wxString(process_client_message(pDoc->notice(childId-1)->description.c_str()), wxConvUTF8); char buf[8192];
strProjectName = wxString(pDoc->notice(childId-1)->project_name, wxConvUTF8); fix_html(pDoc->notice(childId-1)->description.c_str(), buf);
dtBuffer.Set((time_t)pDoc->notice(childId-1)->arrival_time); strDescription = process_client_message(buf);
strArrivalTime = dtBuffer.Format(); strProjectName = wxString(pDoc->notice(childId-1)->project_name, wxConvUTF8);
if (strProjectName.IsEmpty()) { dtBuffer.Set((time_t)pDoc->notice(childId-1)->arrival_time);
strBuffer.Printf(_("%s; received on %s"), strDescription.c_str(), strArrivalTime.c_str()); strArrivalTime = dtBuffer.Format();
} else { if (strProjectName.IsEmpty()) {
strBuffer.Printf(_("%s; received from %s; on %s"), strDescription.c_str(), strProjectName.c_str(), strArrivalTime.c_str()); strBuffer.Printf(_("%s; received on %s"), strDescription.c_str(), strArrivalTime.c_str());
} } else {
strBuffer.Printf(_("%s; received from %s; on %s"), strDescription.c_str(), strProjectName.c_str(), strArrivalTime.c_str());
strBuffer = StripHTMLTags(strBuffer);
*description = strBuffer.c_str();
return wxACC_OK;
} }
strBuffer = StripHTMLTags(strBuffer);
*description = strBuffer.c_str();
return wxACC_OK;
} }
// Let the framework handle the other cases. // Let the framework handle the other cases.
@ -532,7 +548,9 @@ wxString CNoticeListCtrl::OnGetItem(size_t i) const
strProjectName = wxString(np->project_name, wxConvUTF8); strProjectName = wxString(np->project_name, wxConvUTF8);
strURL = wxString(np->link, wxConvUTF8); strURL = wxString(np->link, wxConvUTF8);
strTitle = wxString(process_client_message(np->title), wxConvUTF8); strTitle = wxString(process_client_message(np->title), wxConvUTF8);
strDescription = wxString(process_client_message(np->description.c_str()), wxConvUTF8); char buf[8192];
fix_html(np->description.c_str(), buf);
strDescription = process_client_message(buf);
dtBuffer.Set((time_t)np->arrival_time); dtBuffer.Set((time_t)np->arrival_time);
strArrivalTime = dtBuffer.Format(); strArrivalTime = dtBuffer.Format();