Home » Developing U++ » U++ Developers corner » Pop3 class and reference examples for U++
Re: Pop3 class and reference examples for U++ [message #42610 is a reply to message #42605] |
Wed, 26 March 2014 12:37 |
Oblivion
Messages: 1093 Registered: August 2007
|
Senior Contributor |
|
|
Hello Mirek,
Ah.. I didn't encounter any actual errors but yes, looking more closely, you are right that was my fault, sorry. And thanks for correcting it.
Other than that, after furter examining the code, I shall report an error in the Pop3::GetListItems() method:
Current code omits the last line of the list. So I corrected it.
bool Pop3::GetListItems(ValueMap& list, dword type1, dword type2)
{
StringStream s(data);
for(;;) {
String line = s.GetLine();
if(s.IsError())
return false;
if(s.IsEof()) // << ---- Omits last line of the list. EOF checking should be moved to top.
break;
Vector<String> s = Split(line, ' ');
if(s.GetCount() < 2)
return false;
list.Add(Scan(type1, s[0]), Scan(type2, s[1]));
}
return true;
}
Corrected version:
bool Pop3::GetListItems(ValueMap& list, dword type1, dword type2)
{
StringStream s(data);
while(!s.IsEof()) {
String line = s.GetLine();
if(s.IsError())
return false;
Vector<String> s = Split(line, ' ');
if(s.GetCount() < 2)
return false;
list.Add(Scan(type1, s[0]), Scan(type2, s[1]));
}
return true;
}
Other than that, everything seems fine.
P.S. Thanks a lot for the SplitTo() function, it is and will be very helpful. Too bad those handy utility functions got undocumented.
When I have time I'll examine and document them.
Regards.
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Wed, 26 March 2014 18:29] Report message to a moderator
|
|
|
|
|
Pop3 class and reference examples for U++
By: Oblivion on Fri, 17 January 2014 01:49
|
|
|
Re: Pop3 class and reference examples for U++
By: koldo on Fri, 17 January 2014 08:12
|
|
|
Re: Pop3 class and reference examples for U++
By: mirek on Fri, 17 January 2014 08:27
|
|
|
Re: Pop3 class and reference examples for U++
By: Oblivion on Fri, 17 January 2014 12:00
|
|
|
Re: Pop3 class and reference examples for U++
By: mirek on Tue, 25 March 2014 10:07
|
|
|
Re: Pop3 class and reference examples for U++
By: mirek on Wed, 26 March 2014 10:34
|
|
|
Re: Pop3 class and reference examples for U++
By: Oblivion on Wed, 26 March 2014 12:37
|
|
|
Re: Pop3 class and reference examples for U++
By: Oblivion on Wed, 26 March 2014 18:31
|
|
|
Re: Pop3 class and reference examples for U++
By: mirek on Thu, 27 March 2014 08:45
|
|
|
Re: Pop3 class and reference examples for U++
By: Oblivion on Thu, 27 March 2014 15:24
|
|
|
Re: Pop3 class and reference examples for U++
By: mirek on Thu, 27 March 2014 15:38
|
|
|
Re: Pop3 class and reference examples for U++
By: Oblivion on Sun, 30 March 2014 01:48
|
|
|
Re: Pop3 class and reference examples for U++
By: mirek on Sun, 30 March 2014 09:29
|
|
|
Re: Pop3 class and reference examples for U++
By: Oblivion on Thu, 10 April 2014 01:24
|
|
|
Re: Pop3 class and reference examples for U++
By: Oblivion on Thu, 10 April 2014 16:14
|
|
|
Re: Pop3 class and reference examples for U++
By: mirek on Mon, 28 April 2014 17:48
|
|
|
Re: Pop3 class and reference examples for U++
By: Oblivion on Wed, 16 April 2014 03:00
|
Goto Forum:
Current Time: Mon Apr 29 07:33:38 CEST 2024
Total time taken to generate the page: 0.02431 seconds
|