Simple RSS reader for this forum

If you have a cool piece of software to share, but you are not hosting it officially yet, please dump it in here. If you have code snippets that are useful, please donate!
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg »

Hi Ryan,

At home I have 2 pc's I check RSS feeds on. At work I have another one. To make sure I do not see posts I already read as "unread" one way to sync them is FTP'ing the status of the read posts to a ZIP file (which is a streamed XML file for example) that will be;

1. Read when the XML reader is opened
2. Written when the XML reader is closed

Now when I am at work, and I browsed some articles earlier at home, I can skip the ones that are new.

RSS Bandit was one of my fav readers. But it sucked with Javascript / Active X as some sites were plain unreadable in it. It also refused to retain it's original size from the last time I started it, and had amnesia with some settings. Plain stuff they refused to fix.

Does your reader use the wxMozilla engine? That would be ideal.

I haven't tried your source yet, but I can see if a base source can be set up. For example, should a docking framework be used for the RSS tree and browse panel? As we might develop it further, a lot of people can benefit from a Xplatform reader as from all RSS readers, all X-platform ones are slow as hell or un ugly Java...

Regards,
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
gururamnath
Moderator
Moderator
Posts: 466
Joined: Sat Sep 18, 2004 2:49 am
Location: California, USA

Post by gururamnath »

I'm trying to use the function HtmlUnencode for fixing some rss reader issue that I'm using (FeedIt - http://feedit.berlios.de ). I found 2 problems with the code.

Code: Select all

           
 1           if(s.c_str()[i] == wxT('&'))
2             {
3                 if(s.length() - i >= 7)
4                 {
5                     if(s.c_str()[i] == wxT('&') &&
6                         s.c_str()[i+1] == wxT('#') &&
7                         wxIsdigit(s.c_str()[i+2]) &&
8                         wxIsdigit(s.c_str()[i+3]) &&
9                         wxIsdigit(s.c_str()[i+4]) &&
10                        s.c_str()[i+5] == wxT(';'))
11                    {
12                        sRet += (wxChar) ((s.c_str()[i+2] - wxT('0')) * 100) +
13                                        ((s.c_str()[i+3] - wxT('0')) * 10) +
14                                        ((s.c_str()[i+4] - wxT('0')) );
15                        i += 6;
                        continue;
                    }
                } 
The above is the code snippet pulled from the HtmlUnencode function posted in the forum.

In line 3 , value 7 should be changed to 6. For the string

Code: Select all

"n.n k ä:stä"

the unencode char is at the end of the string and the length of the remaining string will only be equal to 6.

In line 15 , value 6 should be changed to 5. For the string

Code: Select all


"Verokarhun tietokoneen matikkapää loppuu Gatesin kohdalla kesken";


the +5 character is the one next to its boundary.

I have modified the code to make it work with WTL and here is the code snippet

Code: Select all

	void HTMLUnencode(CAtlString& s)
	{
		CAtlString sRet;

		for(size_t i = 0; i < s.GetLength(); ++i)
		{
			if(s.GetString()[i] == '&')
			{
				if(s.GetLength() - i >= 6)
				{
					if(s.GetString()[i] == '&' &&
						s.GetString()[i+1] == '#' &&
						isdigit(s.GetString()[i+2]) &&
						isdigit(s.GetString()[i+3]) &&
						isdigit(s.GetString()[i+4]) &&
						s.GetString()[i+5] == ';')
					{
						sRet += (char)( 
							((s.GetString()[i+2] - '0') * 100) +
						    ((s.GetString()[i+3] - '0') * 10) +
						    ((s.GetString()[i+4] - '0') ));
						i += 5;
						continue;
					}
				}
				if(s.GetLength() - i >= 6)
				{
					if(memcmp(&s.GetString()[i], "&apos;", 6) == 0)
					{
						sRet += '\'';
						i += 5;
						continue;
					}
					if(memcmp(&s.GetString()[i], "&nbsp;", 6) == 0)
					{
						sRet += ' ';
						i += 5;
						continue;
					}
					if(memcmp(&s.GetString()[i], """, 6) == 0)
					{
						sRet += '\"';
						i += 5;
						continue;
					}
				}
				if(s.GetLength() - i >= 5 && memcmp(&s.GetString()[i], "&", 5) == 0)
				{
					sRet += '&';
					i += 4;
					continue;
				}
				if(s.GetLength() - i >= 4)
				{
					if(memcmp(&s.GetString()[i], "<", 4) == 0)
					{
						sRet += '<';
						i += 3;
						continue;
					}
					if(memcmp(&s.GetString()[i], ">", 4) == 0)
					{
						sRet += '>';
						i += 3;
						continue;
					}
				}
			}

			sRet += s.GetString()[i];
		}

		s = sRet;
	} 

-Guru Kathiresan
User avatar
Ryan Norton
Moderator
Moderator
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Post by Ryan Norton »

Just wanted to say thanks to gururamnath he is 100% correct and i thought i changed it a long time ago but i guess it is still only on my local copy :\.
[Mostly retired moderator, still check in to clean up some stuff]
phlox81
wxWorld Domination!
wxWorld Domination!
Posts: 1387
Joined: Thu Aug 18, 2005 7:49 pm
Location: Germany
Contact:

Post by phlox81 »

omg, was a horrorful code :/
Guys, take a look at spirit or yacc or bison if you wanna parse something...
Post Reply